React - 使用create-react-app快速构建开发环境

Create React App

  • 通过npx安装(新的方式,未来推荐)。
    npx on the first line is not a typo — it’s a package runner tool that comes with npm 5.2+.
    npm v5.2.0引入的一条命令(npx),引入这个命令的目的是为了提升开发者使用包内提供的命令行工具的体验。
    npx create-react-app my-react-app这条命令会临时安装 create-react-app 包,命令完成后create-react-app 会删掉,不会出现在 global 中。下次再执行,还是会重新临时安装。
npx create-react-app my-react-app
  • 通过cnpm安装(目前推荐)。
    国内下载太慢,也可以使用淘宝定制的 cnpm 进行安装。
cnpm install -g create-react-app
create-react-app my-app

安装完成后,会显示下列信息。

Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run 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 my-learn
  npm start

Happy hacking!

进入my-app目录,使用 npm start 命令启动。启动后会自动打开浏览器 http://localhost:3000
启动界面:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值