Created
March 17, 2023 01:25
-
-
Save mikansc/fe8ac37976dc69511d94bf886a89e697 to your computer and use it in GitHub Desktop.
Arquivo App do final da aula!
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, useEffect } from "react"; | |
function App() { | |
const corInicial = "btn-primary"; | |
const [nome, setNome] = useState(""); // ["", function() { ... }]; | |
const [cor, setCor] = useState(corInicial); | |
function handleSubmeterFormulario() { | |
alert(nome); | |
} | |
useEffect(() => { | |
console.log(corInicial); | |
}, []); | |
return ( | |
<div> | |
<nav className="navbar bg-dark" data-bs-theme="dark"> | |
<div className="container-fluid"> | |
<span className="navbar-brand mb-0 h1">Turma Itaguaçu!</span> | |
</div> | |
</nav> | |
<main className="container mt-4"> | |
<br /> | |
<div class="mb-3"> | |
<label htmlFor="exampleFormControlInput1" className="form-label"> | |
Nome | |
</label> | |
<input | |
type="text" | |
className="form-control" | |
id="exampleFormControlInput1" | |
placeholder="digite o seu nome..." | |
onChange={(event) => setNome(event.target.value)} | |
/> | |
</div> | |
<button | |
onClick={handleSubmeterFormulario} | |
type="button" | |
className={`btn ${cor} mt-1`} | |
> | |
Primary | |
</button> | |
</main> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment