Created
August 4, 2018 22:13
-
-
Save minmaxdata/ef53a0d8dbb2405c8b9c04dd4da415c4 to your computer and use it in GitHub Desktop.
different ways to set state
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
this.setState(state => { | |
showAnswer: !state.showAnswer | |
}) | |
this.setState(state => ({ | |
showAnswer: !state.showAnswer | |
})) | |
this.setState(state => { | |
return { ...state, | |
showAnswer: !state.showAnswer }; | |
}); | |
this.setState(state => ({ | |
showAnswer: !state.showAnswer | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment