Created
January 7, 2021 05:43
-
-
Save robzlabz/53968d846e8dd4bc2b1ff8e240b46c6c 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
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