forceupdate react code example

Example 1: React best way of forcing component to update

this.forceUpdate();

Example 2: lifecycle method react

INITIALIZATION= setup props and state 
MOUNTING= constructor->componentWillMount->render->componentDidMount//Birth
UPDATE= shouldComponentUpdate->componentWillUpdate->render
  		->componentDidUpdate //Growth
UNMOUNTING= componentWillUnmount //Death

Example 3: shouldcomponentupdate

shouldComponentUpdate(nextProps, nextState) {
  return true;
}

Example 4: component did mmount

componentDidMount()

Example 5: component did mmount

componentDidUpdate(prevProps, prevState, snapshot)

Tags:

Misc Example