Created
October 29, 2018 15:57
-
-
Save shcyiza/5a30fd250d22b2f9eba8fba97fb581d2 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
// create state with constructor | |
constructor(props) { | |
super(props); | |
this.state = {comment: "yo!"}; | |
} | |
// proper way to change the state | |
this.setState({comment: 'Hello'}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment