7.08.0 Component Update Lifecycle For Props
Component Lifecycle
2. Component Updating
Lifecycle Update External Learning Card PDF
getDerivedStateFromProps(props, state)
update your state based on outside changes
rarely used DO: Sync to Props DON'T: Cause Side-EffectsshouldComponentUpdate(nextProps, nextState)
May cancel updating process!
Carefully!
DO: Decide whether to Continue or Not
DON'T: Cause Side-Effectsrender()
Prepare & Structure your JSX CodeUpdate Child Component Props
getSnapshotBeforeUpdate(prevProps, prevState)
rarely used
DO: Last-minute DOM operations DON'T: Cause Side-EffectscomponentDidUpdate
update done!
DO: Cause Side-Effects DON'T: Update State (triggers re-render)