Created
April 13, 2017 21:17
-
-
Save Tin-Nguyen/69fb91be7fa28ad81e74d01a9bc14e4f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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