React Lifecycle

React Life Cycle Methods Means React Under the Hood! Each react component has three main phases:

1. Mounting

2. Updating

3. Unmounting

React component lifecycle

Let’s come this time 1. What does mounting mean? This means that the name of any element in the DOM (created) is Mounting React four does this work :

i. constructor ()

ii. getDerivedStateFromProps ()

iii. render ()

iv. componentDidMount ().

Here the render () method always works but the rest works by defining!

Let’s come this time 2. Updating means that when you update a component it will work in five ways.

i. getDerivedStateFromProps ()

ii. shouldComponentUpdate ()

iii.render ()

iv. getSnapshotsBeforeUpdate ()

v. componentDidUpdate ()

These renders () always work and base the rest on the work!

Last 3. Unmounting means simply removing something from the DOM! This is only done through componentWillUnmount ()!

--

--