Just as life has different phases involved, i.e we are born, grow and later die, React components experience phases as well. The phases which react components undergo are mounting, updating and unmounting.
Components interact with components to provide an interface for user interaction in web applications. However, a component – the building block of every UI we interact with – has a life cycle.
Lets go through the phases briefly.
1. Mounting phase
This is the first phase in a react component. We can as well say it is the birth phase of a react component. In this phase, a component instance is created and inserted into the DOM.(Document Object Model). We have 4 methods in this phase listed below and in their order.
- constructor()
- static getDerivedStateFromProps()
- render()
- componentDidMount()
