react的生命周期

Mounting 已插入真实DOM

Constructor() 继承

componentWillMount() 渲染前调用

render() 渲染

componentDidMount() 第一次渲染后调用

Updating 正在被重新渲染

componentWillReceiveProps() 在组件接收到一个新的prop时调用

shouldComponentUpdate() 返在组件接收到新的props或者state时被调用。

返回一个布尔值

componentWillUpdate() 在组件接收到新的props或者state

但还没有render时被调用

render() 渲染

componentDidUpdate() 在组件完成更新后立即调用

Unmounting 组件被移除

componentWillUnmount() 在组件从DOM中移除的时候立刻被调用