Before you create a react project, you need to install and configure tools such as Webpack and Babel, which are cumbersome to operate. By using Create-react-app to create projects, you can eliminate the installation and configuration of tools such as Webpack and Babel, making it much easier to create projects because they are pre-installed and configured.
Can't wait to experience it.
Below, let's go into the operation together. It's very simple, actually.
Before I use it, I'll start by default you installed the NODEJS and configured NPM, and then the NPM global installation Create-react-app
NPM install-g Create-react-app
Once installed, you can use the command line to create a react project.
Create a new folder:
mkdir React-project
CD React-project
Then create the REACT project with the Create-react-app command:
Create-react-app Hello
You can create a react project and automatically install and match tools such as Webpack and Babel, and you'll be able to quickly develop your project.
Warm tips:
Because the Create-react-app command pre-installs and configures the Webpack and Babel, it also initializes NPM (which can be initialized with NPM Init, After initialization there will be a Package.json file that specifically explains some basic information about your project and can set up NPM custom commands, so there are several custom NPM commands: NPM start: Start running server files NPM run Build: Package A static file with Webpack NPM test: Start testing npm Run Eject: Remove the tool and copy the build dependencies, configuration files