1.ReactJs relies on the NODEJS environment and needs to be installed if Nodejs is not installed. : https://nodejs.org/en/download/
After downloading, install the Windows version of MSI, click Next to do it. After that, the appropriate environment configuration will be OK.
2. Installing the Global Package
We need to install two packages, these two packages are Babel plugins.
Run in Windows:
NPM Install-g Babel
NPM install-g BABEL-CLI
3. Create an App root directory
D:>mkdir Reactapp
D:>CD Reactapp
d:\reactapp> NPM Init
4. Add the corresponding dependent webpack (--save command will add a package to the Package.json file)
D:\REACTAPP>NPM Install Webpack--save
D:\REACTAPP>NPM Install Webpack-dev-server--save
5. Installing react
D:\REACTAPP>NPM Install react--save
D:\REACTAPP>NPM Install React-dom--save
6. Install Babel other plugins
D:\REACTAPP>NPM Install Babel-core
D:\REACTAPP>NPM Install Babel-loader
D:\REACTAPP>NPM Install Babel-preset-react
D:\REACTAPP>NPM Install babel-perset-es2015
7. Create the appropriate file (index.html,app.jsx,main.js,webpack.config.js)
D:\reactapp>cd.>index.html
D:\reactapp>cd.>app.jsx
D:\reactapp>cd.>main.js
D:\reactapp>cd.>webpack.consig.js
8. Configure compilation, service, and load
Edit the Webpack.config.js file, which can be edited with Webstrom.
The contents are as follows:
var config = { entry: './main.js ', output: { path: '/', filename: ' Index.js ', }, devserver: { Inline:true, port:8080 }, module: { loaders: [ { test:/\.jsx?$/, exclude:/node_ modules/, loader: ' Babel-loader ', query: { presets: [' es2015 ', ' React '] } } ] } }module.exports = config;
The appropriate configuration.
REACTJS Environment Construction