Last active
August 22, 2020 02:22
-
-
Save diego-miranda-ng/ea6fb7f897ed86d0d6c962a972ac3fdb to your computer and use it in GitHub Desktop.
Exemplo do uso de estados em componentes de classe.
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
import React from "react"; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
count: 0 | |
}; | |
} | |
render() { | |
return ( | |
<button onClick={() => this.setState({ count: this.state.count + 1 })}> | |
{this.state.count} | |
</button> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment