Created
July 17, 2018 20:19
-
-
Save kocisov/3fac0401417bd927558bd4de5df3ddeb to your computer and use it in GitHub Desktop.
Sup #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends Component { | |
// return false = COMPONENT_SHOULD_NOT_UPDATE! | |
// return true = COMPONENT_SHOULD_UPDATE! | |
shouldComponentUpdate(nextProps, nextState) { | |
// PureComponent do this for you, not for everything tho | |
return this.props.value != nextProps.value; | |
} | |
render() { | |
return ( | |
<div> | |
<h2>{this.props.value}</h2> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment