React up a local development environment

The first step: Make sure you install a newer version of the Node.js .
2789632-46141be4a0740026.png

Step 2: Create React App

npx create-react-app my-app
cd my-app
npm start
2789632-e2536c204ab6c2ba.png

2789632-89fb0da8d5812bca.png

Yarn used here instead of npm.


2789632-840954bceea6c6c9.png
2789632-26b75a637bd9489a.png

The interface looks like at this time to run is not what we want.

The third step: delete all the files in the new project in src / folder.

Step four: src/folder, create a named index.cssfile, and copy the CSS code .

Step Five: In the src/Create a folder named index.jsfile, and copy these JS code .

Step Six: The following three lines of code to copy the src/folder index.jsat the top of file:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';

Step Seven: Start

yarn start


2789632-259bc686004b20db.png

Reproduced in: https: //www.jianshu.com/p/5e3da147afce

Guess you like

Origin blog.csdn.net/weixin_33694172/article/details/91067406