Lifecycle method call in different states
suggest changeThis example serves as a complement to other examples which talk about how to use the lifecycle methods and when the method will be called.
This example summarize Which methods (componentWillMount, componentWillReceiveProps, etc) will be called and in which sequence will be different for a component in different states:
When a component is initialized:
- getDefaultProps
- getInitialState
- componentWillMount
- render
- componentDidMount
When a component has state changed:
- shouldComponentUpdate
- componentWillUpdate
- render
- componentDidUpdate
When a component has props changed:
- componentWillReceiveProps
- shouldComponentUpdate
- componentWillUpdate
- render
- componentDidUpdate
When a component is unmounting:
- componentWillUnmount
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents