Last active
November 22, 2017 06:52
-
-
Save NoamELB/19bc210cf2f53f792a0b425373ec88ce to your computer and use it in GitHub Desktop.
should not update with pure component
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 ShouldNotUpdate extends React.PureComponent { | |
constructor(props) { | |
super(props); | |
this.counter = 0; | |
} | |
render() { | |
return `I should be rendered only 1 time. actual times rendered: ${++this.counter}`; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment