how state updatein shouldupdatecomponent react native code example
Example 1: shouldcomponentupdate
shouldComponentUpdate(nextProps, nextState) {
return true;
}
Example 2: react lifecycle
constructor(props) {
super(props);
// Don't call this.setState() here!
this.state = { counter: 0 };
this.handleClick = this.handleClick.bind(this);
}