生命周期
React < v16.3

红色是在 v17 版本后废弃的生命周期。
细字体的声明周期是不常用的,加粗是常用的。
React > v16.3
React v16.3,引入了两个新的生命周期函数:
getDerivedStateFromProps
getSnapshotBeforeUpdate
随着 getDerivedStateFromProps
的推出,同时deprecate了一组生命周期API,包括:
componentWillReceiveProps
componentWillMount
componentWillUpdate
新的生命周期图如下图所示:

细字体的声明周期是不常用的,加粗是常用的。
Last updated