Created
July 15, 2017 22:36
-
-
Save casprwang/7691da7b1f022cb7ac7aa3a81f62ce39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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