You get a bonus - 1 coin for daily activity. Now you have 1 coin

What are the different component lifecycle phases? in REACT

Practice



  1. The component lifecycle has three distinct lifecycle phases:

    1. Mounting: the component is ready to be mounted into the browser DOM. This phase covers initialisation in the

      constructor()
      ,
      getDerivedStateFromProps()
      ,
      render()
      , and
      componentDidMount()
      lifecycle methods.

    2. Updating: in this phase the component is updated in two ways, by receiving new props and by updating state from

      setState()
      or
      forceUpdate()
      . This phase covers
      getDerivedStateFromProps()
      ,
      shouldComponentUpdate()
      ,
      render()
      ,
      getSnapshotBeforeUpdate()
      and
      componentDidUpdate()
      lifecycle methods.

    3. Unmounting: in this final phase the component is no longer needed and is detached from the browser DOM. This phase includes the

      componentWillUnmount()
      lifecycle method.

    It is worth noting that internally React has a concept of phases when applying changes to the DOM. They are broken down as follows

    1. Render The component will render without any side effects. This applies to Pure components, and at this stage React can pause, abort or restart the render.

    2. Pre-commit Before the component actually applies changes to the DOM, there is a moment that lets React read from the DOM through

      getSnapshotBeforeUpdate()
      .

    3. Commit React works with the DOM and runs the final lifecycles accordingly:

      componentDidMount()
      for mounting,
      componentDidUpdate()
      for updating and
      componentWillUnmount()
      for unmounting.

    React 16.3+ Phases (or the interactive version )

    What are the different component lifecycle phases? in REACT

    Before React 16.3

    What are the different component lifecycle phases? in REACT

created: 2020-02-23
updated: 2026-03-09
297



Was this answer useful?
Choose a quick rating so we can improve the next answer for you.
How satisfied are you?


Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone