Jam3 Lessons - React
For class based components, we have a set of methods available to call during its mounting, unmounting and update cycles.
This is what gets called when a component gets rendered for the first time:
constructor()
componentWillMount()
render()
componentDidMount()
When its state changes or a new prop is passed:
componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
render()
componentDidUpdate()
Finally, before the component gets remove from the DOM componentWillUnmount()
is called.