Skip to content

Instantly share code, notes, and snippets.

@laser
Last active August 29, 2015 14:19
Show Gist options
  • Save laser/670092022a536dee0a68 to your computer and use it in GitHub Desktop.
Save laser/670092022a536dee0a68 to your computer and use it in GitHub Desktop.
var PersonView = React.createClass({
getInitialState: function() {
return { name: 'Erin', age: 32 };
},
componentDidMount: function() {
setTimeout(function() {
this.setState({ age: 33 });
}.bind(this), 1000);
},
render: function() {
return (
<div>
<h1>{this.state.name}</h1>
<div>Age: {this.state.age}</div>
</div>;
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment