Created
March 7, 2023 19:46
-
-
Save douglasabnovato/b185b3891558e9f571cf4974ee08aee1 to your computer and use it in GitHub Desktop.
Código 2. Inicialização do ciclo de vida de um componente
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
import { useState } from "react"; | |
export default function App() { | |
const [contador, setContador] = useState(0); | |
return ( | |
<div className="App"> | |
<h1>Contador: {contador}</h1> | |
<button onClick={() => setContador(contador + 1)}>+</button> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment