React入门2-脚手架搭建

react

一.脚手架搭建

1.安装

npm i -g create-react-app

2.创建react应用

create-react-app xxx(工程名称)

a、主要依赖react,react-dom,react-scripts

{

"name": "learn-react",

"version": "0.1.0",

"private": true,

"dependencies": {

"react": "^16.8.4",

"react-dom": "^16.8.4",

"react-scripts": "2.1.8"

},

"scripts": {

"start": "react-scripts start",

"build": "react-scripts build",

"test": "react-scripts test",

"eject": "react-scripts eject"

},

"eslintConfig": {

"extends": "react-app"

},

"browserslist": [

">0.2%",

"not dead",

"not ie <= 11",

"not op_mini all"

]

}

b.生成目录结构

3.本地启动

npm run start

以上是 React入门2-脚手架搭建 的全部内容, 来源链接: utcz.com/z/381392.html

回到顶部