旧版本:

componentWillMount在渲染前调用,在客户端也在服务端。
componentDidMount在第一次渲染后调用,只在客户端。
componentWillReceiveProps 在组件接收到一个新的 prop (更新后)时被调用。这个方法在初始化render时不会被调用。
shouldComponentUpdate 返回一个布尔值。在组件接收到新的props或者state时被调用。在初始化时或者使用forceUpdate时不被调用。可以在你确认不需要更新组件时使用。
componentWillUpdate在组件接收到新的props或者state但还没有render时被调用。在初始化时不会被调用。
componentDidUpdate 在组件完成更新后立即调用。在初始化时不会被调用。
componentWillUnmount在组件从 DOM 中移除之前立刻被调用。
202110191634637104894238
202110191634637113134971
202110191634637121881786

新版本:

新版本中:

componentWillMount

componentWillReceiveProps

componentWillUpdate

必须加上UNSAFE_前缀,即:

UNSAFE_componentWillMount

UNSAFE_componentWillReceiveProps

UNSAFE_componentWillUpdate