Rapid development of react applications using Create-react-app

Source: Internet
Author: User
Tags install node
React is a JavaScript language tool library. In this era of overwhelming JavaScript tools, there is no accident. First, you need to install Node.js and npm. React itself does not depend on Node.js, but many tools used in our development require Node. js support. You can find a suitable installation method on the official website of Node.js (https://nodejs.org/). When you install Node.js, you also install npm. Npm is a package management tool for Node.js, because we cannot Develop all the functions by yourself, will use a lot of existing installation packages, and need npm's help.
React technology relies on a very large technology stack. For example, translating JavaScript code requires Babel, module packaging tools use Webpack, and custom build processes require grunt or gulp. . Each of these technology stacks requires their own configuration files, and developers have been overwhelmed by various technical terms before they started writing a line of React-related code.
Fortunately, Facebook provides a tool for rapid development of React applications called create-react-app
create-react-app is an installation package released through npm. After confirming that Node.js and npm are installed, execute the following command on the command line to install:
npm install --global create-react-app
After installation, your computer will have a create-react-app execution command.
Next we can create the first react project via cmd command line in any directory where we want to create the project, just execute the following command
create-react-app 20180420
This command will create a directory named 20180420react under the current directory, and an application framework will be automatically added in this directory. Then we only need to modify the files on the basis of this framework to develop React applications, avoiding a lot of manual Configuration works.
After a large text output from the create-react-app command, follow the prompts and enter the following command:
cd 20180420react
npm start
This command will start a server in development mode, and also let your browser automatically open a web page pointing to the local address http: // localhost: 3000 /. The display interface is as follows:
We can modify the content of the web page by modifying the src / App.js file:


Congratulations, your first React application was born ~ let's continue to explore the magic world of React, you will find it more and more interesting ~
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.