getInitialState(), before component is mounted.
componentWillMount(), immediately before mounting.
componentDidMount(), immediately after mounting. DOM-node-dependant initialisation happens here.
componentWillReceiveProps(), invoked when mounted component receives new props from parent. Use this when changing state (
shouldComponentUpdate(), invoked when component 'decides' whether or not to push updates to the DOM. Return
falsefrom this if we don't want React to update.
componentDidUpdate(), invoked immediately after updating.
componentWillUnmount(), immediately before component unmounts and is destroyed. Clean-up goes here.
component.forceUpdate()is also available. This is for any mounted component whose state has changed without
The big, big difference between
state: state is private to components.
A parent component (or any other component) can never manipulate the state of another (with
setState or whatever).
componentWIllReceivePropswill be enough here
Defaults set in
getInitialState will be used for initial rendering.