Skip to content

Instantly share code, notes, and snippets.

@samcorcos
Last active February 3, 2017 01:49
Show Gist options
  • Save samcorcos/e12e55c82175d3486aa6015672eb5792 to your computer and use it in GitHub Desktop.
Save samcorcos/e12e55c82175d3486aa6015672eb5792 to your computer and use it in GitHub Desktop.
import React from 'react'
class App extends React.Component {
constructor(props) {
super(props)
this.counter = 0
this.addOne = this.addOne.bind(this)
}
addOne() {
this.counter += 1
this.forceUpdate()
}
render() {
return (
<div>
<button
onClick={ this.addOne }>
Increment
</button>
{ this.counter }
</div>
)
}
}
export default App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment