react before componentdidmount code example
Example 1: shouldcomponentupdate
shouldComponentUpdate(nextProps, nextState) {
return true;
}
Example 2: component did mmount
componentDidUpdate(prevProps, prevState, snapshot)
shouldComponentUpdate(nextProps, nextState) {
return true;
}
componentDidUpdate(prevProps, prevState, snapshot)