Skip to content

Instantly share code, notes, and snippets.

@fisherwebdev
Created May 5, 2015 18:38
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save fisherwebdev/8f6cb895348c587c8f1e to your computer and use it in GitHub Desktop.
Save fisherwebdev/8f6cb895348c587c8f1e to your computer and use it in GitHub Desktop.
Cheatsheet for React lifecycle and update cycle methods
Lifecycle: | Update:
Mounting and Unmounting | New Props or State
--------------------------------+-----------------------------------
|
getDefaultProps() | componentWillReceiveProps()*
|
getInitialState() | shouldComponentUpdate()
|
componentWillMount() | componentWillUpdate()
|
render() | render()
|
----------------------- DOM Mutations Complete ----------------------
|
componentDidMount() | componentDidUpdate()
|
--------------------------------|
|
componentWillUnmount() |
|
--------------------------------+------------------------------------
*Called only with new props
@nevinm
Copy link

nevinm commented Sep 25, 2016

Could you also add where the DOM mutations are best to be done. Also where the state shouldn't be updated.

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