第一节、详细了解我们的react
1、用户构建用户界面的javascript库
2、学习React需要比较牢固的JS基础和熟悉ES6语法
3、React没有太多的api、可以说用react变成都在写js
第二节、安装nodejs环境
1、nvm list命令查看安装的nodejs版本
2、source ~/.bashrc 临时改变node版本为v8
第三节、create-react-app脚手架搭建项目
1、脚手架启动项目
npm install -g create-react-app
// 或者
yarn add create-react-app -g
// 安装后查看版本
create-react-app --version
// 开始创建项目
create-react-app lixiaoqb
// 创建项目同时自动下载 不用 npm install
cd lixiaoqb
npm start
// 或者
yarn start
2、问题
1、yarn 版本、npm版本、node 版本导致的失败。
2、npm镜像文件地址配置国内、或者公司、导致不能拉取
3、mac要管理元权限 运行命令加上 sudo
4、If you've previously installed create-react-app globally via npm install -g create-react-app,
we recommend you uninstall the package using npm uninstall -g create-react-app
to ensure that npx always uses the latest version.
3、Create-react-app 不用全局安装; 或者忽略本地cli(
卸载 create-react-app 或者 npx --ignore-existing create-react-app my-app
➜ cnpm uninstall -g create-react-app
保障node 稳定版本)如下:
➜ node -v
v12.16.1
➜ npm -v
6.13.4
➜ source ~/.bashrc
➜ node -v
v8.11.2
➜ npm -v
5.6.0
4、create-react-app 没有[src] 文件夹
第四节、分析项目目录结构-重写
插件
ES7 React/Redux/GraphQL/React-Native snippets
rcc
rce
rcep
clg
rfc
rfce