Skip to content

Instantly share code, notes, and snippets.

@casprwang
Created July 15, 2017 22:36
Show Gist options
  • Save casprwang/7691da7b1f022cb7ac7aa3a81f62ce39 to your computer and use it in GitHub Desktop.
Save casprwang/7691da7b1f022cb7ac7aa3a81f62ce39 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import logo from './logo.svg'
import './App.css'
class App extends Component {
constructor() {
super()
this.state = {
value: 0
}
}
handleClick() {
this.setState({
value: this.state.value + 1
})
}
render() {
return (
<div>
{this.state.value}
<button
onClick={() => {
this.handleClick()
}}
>
Click me to add one
</button>
</div>
)
}
}
export default App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment