<p>1.初始化阶段 (componentWillMount() || componentDidMount()) </p>
<p>2.更新阶段 (componentWillUpdate() || componentDidUpdate())</p>
<p>3.卸载阶段 (componentWillUnmount())</p>
<p>4.异常处理阶段 (componentWillCatch()) </p>函数
componentWillMount :在渲染前调用,在客户端也在服务端。
componentDidMount:在第一次渲染后调用,只在客户端。以后组件已经生成了对应的DOM结构,能够经过this.getDOMNode()来进行访问。
componentWillReceiveProps:在组件接收到一个新的prop时被调用。这个方法在初始化render时不会被调用。
shouldComponentUpdate:返回一个布尔值。在组件接收到新的props或者state时被调用。在初始化时或者使用forceUpdate时不被调用,能够在你确认不须要更新组件时使用。
componentWillUpdate:在组件接收到新的props或者state但尚未render时被调用。在初始化时不会被调用。
componentDidUpdate:在组件完成更新后当即调用。在初始化时不会被调用。
componentWillUnmount:在组件从 DOM 中移除的时候马上被调用。
this