目录
static getDerivedStateFromProps(nextProps, state)
shouldComponentUpdate(nextProps, nextState)
getSnapshotBeforeUpdate(prevProps, prevState)
componentDidUpdate(prevProps, prevState, snapshot)
挂载
- constructor
- static getDerivedStateFromProps(纯函数,静态方法)
- render
- componentDidMount
更新
- static getDerivedStateFromProps
- shouldComponentUpdate
- render
- getSnapshotBeforeUpdate
- componentDidUpdate
卸载
- componentWillUnmount
React从v16.3开始弃
componentWillMount、
componentWillReceiveProps
、componentWillUpdate
三个钩子函数
各个阶段生命周期函数
constructor()
constructor() 在React组件挂载之前被调用,在