Skip to content

Instantly share code, notes, and snippets.

@abhilashsajeev
Created April 27, 2017 06:53
Show Gist options
  • Save abhilashsajeev/91ebc144d97d340097c373ebb07b2e50 to your computer and use it in GitHub Desktop.
Save abhilashsajeev/91ebc144d97d340097c373ebb07b2e50 to your computer and use it in GitHub Desktop.
class Count extends React.Component {
constructor(){
this.state = {
count: 0
}
}
handleOnClick = ()=>{
let count = this.state.count + 1;
this.setState({count: count})
}
render(){
return (
<div>
<button onClick={this.handleOnclick}>Inc</butto,>
{{this.state.count}}
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment