https://zh-hans.reactjs.org/b...
componentWillMount → UNSAFE_componentWillMounthtml
componentWillReceiveProps → UNSAFE_componentWillReceivePropsreact
缘由:redux
props
未变化,依然会调用该函数方案dom
在render中处理最终须要的渲染相关数据函数
componentShouldUpdate
仅处理 props
相关使用getDerivedStateFromProps,仅会在渲染前调用,返回值应用于state
,不经过setState
队列。设计
componentWillUpdate → UNSAFE_componentWillUpdatecode
缘由:component
setState
或者触发react-redux
中的action
方案server
setState
等方法。