recat的生命周期
react 的生命周期分为初始化(initial),更新(update)和销毁(unmount)
initial之前
- props发生改变
- componentWillReceiveProps
组件将要接受props - shouldComponentUpdate
组件是否要更新//shouldCompontUpdate钩子调用后返回一个boolean // ====> false 继续运行 // ====> true 执行渲染操作 - 渲染操作
- 渲染操作
- componentWillUpdate
组件将要更新 - componentDidUndate
组件已经更新 - 运行
- componentWillReceiveProps
- state发生改变
- shouldComponentUpdate
组件是否要更新//shouldCompontUpdate钩子调用后返回一个boolean // ====> false 继续运行 // ====> true 执行渲染操作
- 渲染操作

- shouldComponentUpdate