ninetails
5/2/2016 - 9:16 PM

The Life-Cycle of a Composite Component

The Life-Cycle of a Composite Component

Source: http://jamesknelson.com/should-i-use-react-createclass-es6-classes-or-stateless-functional-components/

- 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.