使用react我们可以有两种方式,一种是引入.js文件来使用React(不推荐),第二种是使用脚手架工具来搭建环境,也是我下面也要重点介绍的环境搭建的方式。
搭建流程我们可以参考官网
好了,别再废话了,下面来谈谈具体搭建流程吧~
React开发环境安装
先全局安装create-react-app模块
npm install -g create-react-app
通过create-react-app创建一个hello-world项目
create-react-app hello-world
进入到项目目录并运行React项目
cd hello-world
npm start
当看到以下页面时,说明你的React环境已经搭建好了
![](https://img.haomeiwen.com/i13055508/62ca4c7fe94bf171.png)
网友评论