ReactJs环境搭建

  • 官方脚手架:create-react-app  搭建开发环境

  1. 终端全局安装 脚手架 :                                                                                                                                 npm install -g create-react-app
  2. 创建项目:

    create-react-app ‘你的项目名称’  //例如 create-react-app hello-react

  3. 运行项目:切换到项目目录下输入:npm start,此时会提示你要创建一个生产版本:npm run build ---》安装 server:npm install -g serve --》创建生产版本本地服务:serve -s build   下面截图是我本地操作

        ReactJs环境搭建_第1张图片

如何将本项目上传到git:

首先,登录自己的github,创建一个新的repository,然后在本地项目目录下添加以下代码:

git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/cloverBeth/React-tutorial.git
git push -u origin master


如何在sublime上安装react开发环境,可参考链接:

http://www.cnblogs.com/terrylin/p/4942332.html


无状态组件

ReactJs环境搭建_第2张图片

ReactJs环境搭建_第3张图片



高阶组件hoc处理无状态组件

ReactJs环境搭建_第4张图片



React的生命周期

ReactJs环境搭建_第5张图片

ReactJs环境搭建_第6张图片

执行顺序

ReactJs环境搭建_第7张图片

ReactJs环境搭建_第8张图片


你可能感兴趣的:(ReactJs,学习笔记)