深入理解react和redux

babel-react-optimize自动去除propTypes

React生命周期

  1.装载过程(mount),也就是把组件第一次在DOM树中渲染的过程;

  2.更新过程(Update),当组件被重新渲染的过程;

  3.卸载过程(Unmount),组件从DOM中删除的过程。

 

  1、装载过程

  • constructor

    目的:1)初始化state

       2)绑定成员函数的this环境

  • componentWillMount

      作用不大,内容可以放到constructor中

  • render

      渲染内容,最重要

  • componentDidMount

  2、更新过程

  • componentWillReceiveProps
  • shouldComponentUpdate
  • componentWillUpdate
  • render
  • componentDidUpdate
posted @ 2018-06-06 21:41  zxs2016  阅读(99)  评论(0编辑  收藏  举报