Skip to content

Instantly share code, notes, and snippets.

@jesse-spevack
Created February 4, 2017 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesse-spevack/75557faf1d9c42d607fd200e052866ea to your computer and use it in GitHub Desktop.
Save jesse-spevack/75557faf1d9c42d607fd200e052866ea to your computer and use it in GitHub Desktop.
```javascript
import {Component} from 'react'
class Counter extends Component {
state = {
count: 0
};
render() {
return <button onClick={this.increment.bind(this)}>{this.state.count}</button>
}
increment() {
this.setState({count: this.state.count + this.props.increment});
}
}
export default Counter;
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment