Skip to content

Instantly share code, notes, and snippets.

@isnifer
Created November 29, 2015 11:25
Show Gist options
  • Save isnifer/7f49b285d8fa07af068c to your computer and use it in GitHub Desktop.
Save isnifer/7f49b285d8fa07af068c to your computer and use it in GitHub Desktop.
The Life-Cycle of a Composite Component
/**
* ------------------ 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