React Component Lifecycle methods - sameeri/Code-React GitHub Wiki

When a component is asked to be rendered,

  • React fetches the component definition
  • Instantiates the class. This is a JavaScript object, a Virtual DOM representation.
  • Mounts it on the actual DOM.
  • Any updates are observed and rerendering happens.

To manage the component, in the life cycle of a component, React provides three classes of interfaces for the developer.

  • Mounting
  • Updating
  • Unmounting

The following are the methods in each class.

Mounting

Lifecycle method one time invocation called during initial render
componentWillMount Yes Yes
componentDidMount Yes Yes

Updating

Lifecycle method one time invocation called during initial render
componentWillRecieveProps No No
shouldComponentUpdate No No
componentWillUpdate No No
componentDidUpdate No No

UnMounting

Lifecycle method one time invocation called during initial render
componentWillUnMount Yes No