Skip to content

Instantly share code, notes, and snippets.

@gisderdube
Created December 27, 2018 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gisderdube/6c086b36ce3bba1a621993650a7cbce2 to your computer and use it in GitHub Desktop.
Save gisderdube/6c086b36ce3bba1a621993650a7cbce2 to your computer and use it in GitHub Desktop.
class Counter extends React.Component {
constructor(props) {
super(props)
this.state = { count: 0 }
}
render() {
return(
<div>
<h1>{this.state.count}</h1>
<button onClick={this._increaseCount}>Increase Count</button>
</div>
)
}
_increaseCount = () => {
this.setState({ count: this.state.count + 1 })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment