1. React Scaffolding
- Scaffolding is essential for developing modern Web applications
- Make full use of tools such as Webpack, Babel, Eslint, etc
- Zero configuration, no manual configuration cumbersome tools can be used
- Focus on business, not tool configuration
2. Initialize the project using scaffolding
2.1 Initialize the project.
This section describes the NPX command
- A command introduced in NPM v5.2.0.
- Objective: To improve the user experience of the command line tools provided in the package.
- Originally: install the scaffolding package first, using the commands provided in this package.
Create-react-app is the name of the scaffolding.
npx create-react-app my-app
Copy the code
2.2 Running commands:
npm start
Copy the code
2.3 Find the index.js file
Again, three steps from the previous article:
- Import files are simply no longer script tag references, using ES6’s modular syntax
- Create the element
- Render elements
// Modular syntax in ES6
// 1. Import files
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
// 2. Create an element
const title = React.createElement('h1'.null."Hello React")
// 3 Render elements
ReactDOM.render(title,document.getElementById('root'))
Copy the code
3. The instructions
ReactDOM is only suitable for Web development if it is mobile react-Native