Skip to content

Instantly share code, notes, and snippets.

@sashadev-sky
Created December 10, 2018 17:37
Show Gist options
  • Save sashadev-sky/2e5dd651f4a0894aa47b1c3d8a4e0e43 to your computer and use it in GitHub Desktop.
Save sashadev-sky/2e5dd651f4a0894aa47b1c3d8a4e0e43 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(nextProps) *only called if parent updated*
* - shouldComponentUpdate(nextProps, nextState)
* - componentWillUpdate(nextProps, nextState)
* - render()
* - [children's constructors or receive props phases]
* - componentDidUpdate(prevProps, prevState)
*
* - 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