深入理解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

猜你喜欢

转载自www.cnblogs.com/zxscn2013/p/9147524.html