Skip to content

Instantly share code, notes, and snippets.

@samuelsilvadev
Created October 6, 2018 14:11
Show Gist options
  • Save samuelsilvadev/561034e10de3f5bae04ab761a9122a28 to your computer and use it in GitHub Desktop.
Save samuelsilvadev/561034e10de3f5bae04ab761a9122a28 to your computer and use it in GitHub Desktop.
Lifecycle Hooks React

Lifecycle Hooks React

1 - MOUNT PHASE

  • When the element is created and inserted in the DOM.

  • React calls these hooks (methods).

    • constructor()
    • render()
    • componentDidMount()

2 - UPDATE PHASE

  • When props or state change.

    • render()
    • componentDidUpdate()

3 - UNMOUNT PHASE

  • When the element is removed form DOM.

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