Skip to content

Instantly share code, notes, and snippets.

@shengoo
Created April 14, 2018 13:38
Show Gist options
  • Save shengoo/fac9e8f599926e7f90ead03185788f24 to your computer and use it in GitHub Desktop.
Save shengoo/fac9e8f599926e7f90ead03185788f24 to your computer and use it in GitHub Desktop.

React Component lifecycle

Single component

init

  1. constructor
  2. componentWillMount
  3. render
  4. componentDidMount

update

  1. componentWillReceiveProps
  2. componentWillUpdate
  3. render
  4. componentDidUpdate

with child

init

  1. constructor in parent
  2. componentWillMount in parent
  3. render in parent
  4. constructor in child
  5. componentWillMount in child
  6. render in child
  7. componentDidMount in child
  8. componentDidMount in parent

update

  1. componentWillReceiveProps in parent
  2. componentWillUpdate in parent
  3. render in parent
  4. componentWillReceiveProps in child
  5. componentWillUpdate in child
  6. render in child
  7. componentDidUpdate in child
  8. componentDidUpdate in parent

unmount

  1. componentWillUnmount in parent
  2. componentWillUnmount in child
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment