Skip to content

Instantly share code, notes, and snippets.

@diego-miranda-ng
Last active August 22, 2020 02:22
Show Gist options
  • Save diego-miranda-ng/ea6fb7f897ed86d0d6c962a972ac3fdb to your computer and use it in GitHub Desktop.
Save diego-miranda-ng/ea6fb7f897ed86d0d6c962a972ac3fdb to your computer and use it in GitHub Desktop.
Exemplo do uso de estados em componentes de classe.
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