Created
June 18, 2022 08:06
-
-
Save GuillaumeDaviid/31c509a34ced7dbd3901902ae7044c70 to your computer and use it in GitHub Desktop.
react composant : example 4
This file contains hidden or 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 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