Skip to content

Instantly share code, notes, and snippets.

@AndrewIngram
Last active August 29, 2015 14:14
Show Gist options
  • Save AndrewIngram/f0574f79fca8e13e201b to your computer and use it in GitHub Desktop.
Save AndrewIngram/f0574f79fca8e13e201b to your computer and use it in GitHub Desktop.
export class Counter extends React.Component {
static get propTypes() {
return {
initialCount: React.PropTypes.number
};
}
static get defaultProps() {
return {
initialCount: 1
};
}
tick() {
this.setState({count: this.state.count + 1});
}
render() {
return (
<div onClick={this.tick.bind(this)}>
Clicks: {this.state.count}
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment