Skip to content

Instantly share code, notes, and snippets.

@ojulianos
Created November 29, 2023 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojulianos/308905fd59527417a55b213cbb850e4a to your computer and use it in GitHub Desktop.
Save ojulianos/308905fd59527417a55b213cbb850e4a to your computer and use it in GitHub Desktop.
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