【删除生命周期】
1、componentWillMount
2、componentWillReceiveProps
3、componentWillUpdate
【新增生命周期】
1、getDerivedStateFromProps(从 props 获取衍生的 state):componentWillReceiveProps 的重命名
2、getSnapshotBeforeUpdate(更新前获取快照):
props、state 更新,都会触发。(state 更新包括 setState 操作和 forceUpdate 操作)
render 后、React 更新 DOM 和 refs 前,进入。
React 更新 DOM 和 refs 后,进入 componentDidUpdate。
【新版生命周期图示】

网友评论