注: node.js >= 6
全局安装create-react-app
npm install -g create-react-app
create-react-app project-name
cd project-name
npm start
如果你的npm版本大于5.2
那么可以使用
npx create-react-app my-app
cd my-app
yarn start
目录结构
my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│ └── favicon.ico
│ └── index.html
│ └── manifest.json
└── src
└── App.css
└── App.js
└── App.test.js
└── index.css
└── index.js
└── logo.svg
└── registerServiceWorker.js
以开发模式运行应用程序。
打开http:// localhost:3000在浏览器中查看它。
备注:npm 和 yarn 都是包管理工具