idev0085 / react-boilerplate

0 stars 0 forks source link

What are the different phases of React component’s lifecycle? #93

Open idev0085 opened 2 years ago

idev0085 commented 2 years ago

A React Component can go through four stages of its life as follows.

Initialization: This is the stage where the component is constructed with the given Props and default state. This is done in the constructor of a Component Class.

Mounting: Mounting is the stage of rendering the JSX returned by the render method itself.

Updating: Updating is the stage when the state of a component is updated and the application is repainted.

Unmounting: As the name suggests Unmounting is the final step of the component lifecycle where the component is removed from the page.