-
-
Save matheusml/8a4a053697f7147e71e40b365434e1a3 to your computer and use it in GitHub Desktop.
This file contains 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 from 'react'; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { count: 0 }; | |
} | |
increment() { | |
this.setState({ count: this.state.count + 1 }); | |
} | |
render() { | |
return ( | |
<div> | |
<h1>{this.state.count}</h1> | |
<button onClick={this.increment.bind(this)}>+</button> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment