Created
November 29, 2023 22:48
-
-
Save ojulianos/308905fd59527417a55b213cbb850e4a to your computer and use it in GitHub Desktop.
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'; | |
function FormularioCadastro() { | |
const [nome, setNome] = useState(''); | |
const [email, setEmail] = useState(''); | |
const [formData, setFormData] = useState({ | |
nome: '', | |
email: '', | |
}); | |
return ( | |
<form> | |
<label htmlFor="nome">Seu nome:</label> | |
<input | |
type="text" | |
id="nome" | |
value={formData.nome} | |
onChange={(event) => | |
setFormData({ ...formData, nome: event.target.value }) | |
} | |
/> | |
<br /> | |
<label htmlFor="email">Seu e-mail:</label> | |
<input | |
type="email" | |
id="email" | |
value={formData.email} | |
onChange={(event) => | |
setFormData({ ...formData, email: event.target.value }) | |
} | |
/> | |
</form> | |
); | |
} | |
export default function App() { | |
return ( | |
<div className="container"> | |
<h2>Cadastre-se</h2> | |
<FormularioCadastro /> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment