Skip to content

Instantly share code, notes, and snippets.

@matheusml
Created June 20, 2017 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheusml/8a4a053697f7147e71e40b365434e1a3 to your computer and use it in GitHub Desktop.
Save matheusml/8a4a053697f7147e71e40b365434e1a3 to your computer and use it in GitHub Desktop.
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