create-react-app
1、首先安装create-react-app 脚手架
npm install -g create-react-app
2、使用脚手架创建一个自己的项目
我在桌面位置创建 react01项目
create-react-app react01
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IMlEFqwC-1632900630309)(https://i.loli.net/2021/09/08/BnKLOZhvg8NQaJp.png)]
3、启动我的项目
进入我的项目->package.json文件中配置了一些短命令:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
yarn start
启动我的项目:
自动弹出浏览器
注意:编辑'src/App.js' 保存后会重新加载
到此成功运行!