Articles → REACT.JS → React Lifecycle

React Lifecycle






Phases Of The Component




  1. Mounting
  2. Updating
  3. Unmounting

Mounting




  1. constructor() → This is the very first method called in the mounting phase. This method is used to initialize variable values
  2. getDerivedStateFromProps() → This method is called just before the render method
  3. render() → This method outputs the HTML on the browser
  4. componentDidMount() → This method is called after the render method



Updating




  1. getDerivedStateFromProps()
  2. shouldComponentUpdate() → Checks if the component output is affected by the change in the state or props
  3. render()
  4. getSnapshotBeforeUpdate() → This method is called before the update. Calling componentDidUpdate method is also required along with getSnapshotBeforeUpdate
  5. componentDidUpdate() → This method is called when a component is updated

Unmounting




  1. componentWillUnmount() → This method is called when the component is about to be removed from the DOM



Posted By  -  Karan Gupta
 
Posted On  -  Saturday, August 21, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250