preface

This section describes how to debug the React source code

  • The React version uses 17.0.2;
  • A Java JDK needs to be installed for packaging
  • Node is available in 14+

React react

The author is currently executing the following command in the git folder

git clone [email protected]:facebook/react.git
Copy the code

When you look at the console and see the image below, the React source is downloaded successfully

cd react
Copy the code

Perform yarn

yarn
Copy the code

Execute pack command

yarn build react/index,react/jsx,react-dom/index,scheduler --type=NODE
Copy the code

When you see the picture below you should have packed successfully

Modify react and react-dom Pointers

This creates a local dependency pointing using YARN Link

Modify the react

Perform:

cd build/node_modules/react
Copy the code
yarn link
Copy the code

If you see the image below, it should be created successfully.

Modify the react – dom

Exit current folder

cd .. 
Copy the code

Go to the react-do folder

cd react-dom
Copy the code

Perform yarn link

yarn link
Copy the code

The picture below shows success

Create the React project

Use create-react-app to create a project named react-code

React was created successfully

Enter the React-code project

cd react-code
Copy the code

Toggle react and react-dom pointing

yarn link react react-dom
Copy the code

test

In the git/react/build/node_modules/react/CJS/react development. Add js file

Git git git git git git git git git git git git git git git git

Start the react – code

Watch to see if the console prints 100

The react source code is already available for debugging. If you need it, try it

conclusion

The author level is limited, if there is insufficient welcome to correct; Any comments and suggestions are welcome in the comments section