Created
June 3, 2018 02:55
-
-
Save bowbahdoe/7a0cc09892551d5ca193590f6729f011 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
class App extends React.Component { | |
constructor(props) { | |
this.state = { | |
count: 0 | |
} | |
} | |
onClick(e) { | |
this.setState({ | |
count: this.state.count + 1 | |
}); | |
} | |
render() { | |
return ( | |
<div> | |
<h1>{this.state.count}</h1> | |
<button onClick={this.onClick.bind(this)}>Count Up!!</button> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment