Skip to content

Instantly share code, notes, and snippets.

@chrisjlee
Last active January 5, 2016 04:33
Show Gist options
  • Save chrisjlee/cf47e3023651f9efcc78 to your computer and use it in GitHub Desktop.
Save chrisjlee/cf47e3023651f9efcc78 to your computer and use it in GitHub Desktop.
Reactjs component lifecycle
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment