Skip to content

Instantly share code, notes, and snippets.

@donpark
Last active May 3, 2016 23:45
Show Gist options
  • Save donpark/db6dc70f6e56ab23951e4e31faa30206 to your computer and use it in GitHub Desktop.
Save donpark/db6dc70f6e56ab23951e4e31faa30206 to your computer and use it in GitHub Desktop.
React.js Component Lifecycle

Invokation sequence of React.js Component Lifecycle Methods under four distinct conditions:

initial render

  • componentWillMount
  • render
  • componentDidMount

props change

  • componentWillReceiveProps
  • shouldComponentUpdate
  • componentWillUpdate
  • render
  • componentDidUpdate

state change (via setState)

  • shouldComponentUpdate
  • componentWillUpdate
  • render
  • componentDidUpdate

forced update

  • componentWillUpdate
  • render
  • componentDidUpdate

Note: popular data store frameworks like mobx uses forceUpdate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment