React.js Component Lifecycle
lets you perform actions
when a component is created, updated or destroyed.
It also allows you to decide
if a component should be updated at all
and react to props or state changes.
React.js Component Lifecycle
React.js Component Lifecycle
mounting
updating
Initializing
unmounting
Error Handling
Various methods are executed at specific points in a component's lifecycle.
Initializing
class fields
React.js Component Lifecycle
componentDidMount ( )
mounting
React.js Component Lifecycle
render ( )
* commonly used
* commonly used
constructor ( props )
* commonly used
static getDerivedStateFromProps( props, state )
* rarely used
componentWillMount ( )
* will deprecate
React.js Component Lifecycle
componentWillReceiveProps( )
componentWillUpdate( )
render ( )
updating
shouldComponentUpdate( nextProps , nextState )
componentDidUpdate( prevProps, prevState)
* will deprecate
* will deprecate
getSnapshotBeforeUpdate(prevProps, prevState)
static getDerivedStateFromProps( nextProps , currentState )
* rarely used
* rarely used
* commonly used
* commonly used
Commit phase
componentWillUnmount ( )
unmounting
React.js Component Lifecycle
componentDidCatch ( )
Error Handling
React.js Component Lifecycle