React lifecycle new vs old

old version

when mounted

constructor()

componentWillMount()

render()

componentDidMount()

when updating

componentWillReceiveProps()

shouldComponentUpdate()

componentWillUpdate()

render()

componentDidUpdate()

when uninstalling

componentWillUnmount()

 

New version (starting from 16.3)

when mounted

constructor()

static getDerivedStateFromProps()

render()

componentDidmount()

when updating

static getDerivedStateFromProps()

shouldComponetUpdate()

render()

getSnapshotBeforeUpdate()

componentDidUpdate()

when uninstalling

componentWilUnmount()

Guess you like

Origin blog.csdn.net/weixin_48352984/article/details/127130436