前提已经安装好了node

 

$ npm install -g cnpm --registry=https://registry.npm.taobao.org
$ npm config set registry https://registry.npm.taobao.org

 

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

 

 

执行以下命令创建项目:

$ cnpm install -g create-react-app
$ create-react-app my-app
$ cd my-app/
$ npm start

在浏览器中打开 http://localhost:3000/ ,结果如下图所示:

通过 npm 使用 React

相关文章: