Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save GuillaumeDaviid/31c509a34ced7dbd3901902ae7044c70 to your computer and use it in GitHub Desktop.

Select an option

Save GuillaumeDaviid/31c509a34ced7dbd3901902ae7044c70 to your computer and use it in GitHub Desktop.
react composant : example 4
class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0
};
}
render() {
return (
<div>
<p>count: {this.state.count} times</p>
<button onClick={() => this.setState({ count: this.state.count + 1 })}>
Click
</button>
</div>
);
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment