Skip to content

Instantly share code, notes, and snippets.

@robzlabz
Created January 7, 2021 05:43
Show Gist options
  • Save robzlabz/53968d846e8dd4bc2b1ff8e240b46c6c to your computer and use it in GitHub Desktop.
Save robzlabz/53968d846e8dd4bc2b1ff8e240b46c6c to your computer and use it in GitHub Desktop.
class CounterComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0
};
}
render() {
return (
<div>
<p>Sudah di click : {this.state.count} kali</p>
<button onClick={() => this.setState({ count: this.state.count + 1 })}>
Click Saya
</button>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment