Skip to content

Instantly share code, notes, and snippets.

@mkamakura
Last active August 29, 2015 14:17
Show Gist options
  • Save mkamakura/eadb2a78b4a381c2d60d to your computer and use it in GitHub Desktop.
Save mkamakura/eadb2a78b4a381c2d60d to your computer and use it in GitHub Desktop.
var Base = React.createClass({
getInitialState() {
return {count: 0};
},
onClick() {
this.setState({count: this.state.count + 1});
},
render() {
return (
<div>
<h1>{this.props.name}</h1>
<div>count: {this.state.count}</div>
<button onClick={this.onClick}>click!</button>
</div>
)
}
});
React.render(
<Base name="count up!"/>,
document.getElementById('content')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment