Skip to the content.

lifecycle of react?

our React components follow this cycle as well: they’re created (mounted on the DOM), they experience growth (by updating) and they die (unmounted from the DOM). This is the component lifecycle! Within the lifecycle of a component, there are different phases. These phases each have their own lifecycle methods. Lets now take a look at these methods. The Lifecycle Methods A component’s lifecycle can be broken down into four parts:

 html and css

Put the following things in the order that they happen:

componentDidMount, render, constructor, componentWillUnmount, React Updates:

The order for the previous methods is: constructor render componentDidMount React Updates componentWillUnmount


componentDidMount() is a hook that gets 
invoked right after a React component has 
been mounted aka after the first render() lifecycle.

we re-render our application

only be triggered if a component’s state has changed. The state can change from a props change, or from a direct setState change. The component gets the updated state and React decides if it should re-render the component.

prop VS state ?

 html and css

LinkedIn

Email: ibrahem.omari96@gmail.com