Created
February 22, 2018 19:52
-
-
Save AndreiCalazans/a824e5c04b7cbdaf5f386f8cb562a821 to your computer and use it in GitHub Desktop.
This file contains 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 YourCoolComponent extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
counter: 0, | |
}; | |
this.add = this.add.bind(this); | |
} | |
add() { | |
this.setState(prevState => ({ counter: prevState.counter + 1 })); | |
} | |
render () { | |
return ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment