Created
August 23, 2015 00:29
-
-
Save uxnjs01/dd3958f5d05c62b440bd to your computer and use it in GitHub Desktop.
Component with 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
var StateExample = React.createClass({ | |
render: function() { | |
getInitialState: function() { | |
return { | |
likes: 3 | |
} | |
}, | |
return ( | |
<p> | |
{this.state.likes} people like this. | |
</p> | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the tutorial at: http://www.uxnjs.com/how-to-update-state-in-react/