react+webpack搭建项目

一、环境准备

①node

②npm

二、开始搭建

①使用npm安装create-react-app工具,在cmd命令行中输入:

npm install -g create-react-app

②使用命令创建新的react项目,在cmd命令行中输入:

create-react-app first-react-app

// first-react-app为你需要创建的项目名称

③打开创建好的项目文件夹(此例中为first-react-app的文件夹),接着在cmd命令行中输入:

npm init  (然后一直回车)

npm install --save react react-dom (在该目录下导入react和react-dom)

npm install --save react-router-dom (react路由)

npm start (启动项目)

 

posted @ 2019-03-08 11:16  风雨飘飘飘啊飘  阅读(185)  评论(0编辑  收藏  举报