创建 React 项目

框架

浏览数:460

2019-8-15

依次输入命令:

npm install -g create-react-app
create-react-app react16

cd my-app
npm start

在浏览器中输入 local:3000 即可查看项目运行效果:

* 使用 create-react-app 创建项目成功在命令行中有提示信息如下,分别给出了项目启动、打包、测试和弹出配置文件的命令:

Success! Created react16 at /Users/wangxi/.Trash/react16/react16
Inside that directory, you can run several commands:
  yarn start
    Starts the development server.
  yarn build
    Bundles the app into static files for production.
  yarn test
    Starts the test runner.
  yarn eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
  cd react16
  yarn start
Happy hacking!

参考: Creating a New Application

作者:Raychan