What is create-react-app? What can create-react-app do? This article will share with you how to build a React development environment using create-react-app.
1. What is create-react-app?
It is very difficult for beginners to build a react project and build its development environment! Therefore, Facebook specially developed the create-react-app command for building the react project development environment!
create-react-app is created based on webpack ES6.
2. How to use.
Execute the following commands on the command line in sequence to complete the project construction.
cnpm install -g create-react-appcreate-react-app my-app //这里的my-app是随便起的一个项目名称而已。 cd my-app/ npm start
The final project directory is as follows:
The rendering is like this:
3. Description of the project directory:
public Folder: The index.html inside is the project template of the index entry page that is finally packaged for the entire react project. But it has nothing to do with our code writing, and is related to the final page display.
src folder: is where we write code.
src/index.js: It is the entry js file of the entire project.
src/app.js: It is a component introduced by index and also represented by a js file.
src/index.css: style file in index.js.
src/app.css: It is the style file of app.js.
logo.svg: It is an svg image file. Used for interface display.
4. However, I personally will not be satisfied with such a structure, and it is not suitable for development.
The following is an initial transformation I made:
Change the directory, change the project path, and continue our project development work in this directory.
Related recommendations:
WeChat Mini Program Tutorial Mini Program Configuration
Comparative Differences between WeChat Mini Program and Alipay Mini Program introduce
The above is the detailed content of What is create-react-app? create-react-app builds applications for React development environment. For more information, please follow other related articles on the PHP Chinese website!