Skip to content

Instantly share code, notes, and snippets.

@almond-bongbong
Last active September 4, 2018 12:33
Show Gist options
  • Save almond-bongbong/17a01d1191a05620cbf060ac725cf41f to your computer and use it in GitHub Desktop.
Save almond-bongbong/17a01d1191a05620cbf060ac725cf41f to your computer and use it in GitHub Desktop.
// this.state.count : 1
incrementCount(){
this.setState({count : this.state.count + 1})
this.setState({count : this.state.count + 1})
}
// this.state.count : 2
incrementCount(){
this.setState((prevState, props) => {
count: prevState.count + 1
});
this.setState((prevState, props) => {
count: prevState.count + 1
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment