Skip to content

Instantly share code, notes, and snippets.

@Tin-Nguyen
Created April 13, 2017 21:17
Show Gist options
  • Save Tin-Nguyen/69fb91be7fa28ad81e74d01a9bc14e4f to your computer and use it in GitHub Desktop.
Save Tin-Nguyen/69fb91be7fa28ad81e74d01a9bc14e4f to your computer and use it in GitHub Desktop.
class CounterButton extends React.PureComponent {
constructor(props) {
super(props);
this.state = {count: 1};
}
render() {
return (
<button
color={this.props.color}
onClick={() => this.setState(state => ({count: state.count + 1}))}>
Count: {this.state.count}
</button>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment