Cheatsheet for React lifecycle and update cycle methods
Lifecycle: | Update: | |
Mounting and Unmounting | New Props or State | |
--------------------------------+----------------------------------- | |
| | |
getDefaultProps() | componentWillReceiveProps()* | |
| | |
getInitialState() | shouldComponentUpdate() | |
| | |
componentWillMount() | componentWillUpdate() | |
| | |
render() | render() | |
| | |
----------------------- DOM Mutations Complete ---------------------- | |
| | |
componentDidMount() | componentDidUpdate() | |
| | |
--------------------------------| | |
| | |
componentWillUnmount() | | |
| | |
--------------------------------+------------------------------------ | |
*Called only with new props |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Could you also add where the DOM mutations are best to be done. Also where the state shouldn't be updated.