Created
August 23, 2021 04:20
-
-
Save MoranggNormal/c10c7f1264e4652eedc029171f65162c 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 React, {useState} from 'react' | |
export default function Home() { | |
const [stats, setStats] = useState({ | |
nome: '', | |
cargo: '', | |
birth: '', | |
address: '', | |
bairro: '', | |
city: '', | |
cep: '', | |
number: '', | |
contact: '', | |
mail: '', | |
identity: '', | |
cpf: '', | |
isDriver: '', | |
habilitacao: '' | |
}) | |
const [data, setData] = useState([ | |
{name: 'nome'}, | |
{name: 'cargo'}, | |
{name: 'birth'}, | |
{name: 'address'}, | |
{name: 'bairro'}, | |
{name: 'city'}, | |
{name: 'cep'}, | |
{name: 'number'}, | |
{name: 'contact'}, | |
{name: 'mail'}, | |
{name: 'identity'}, | |
{name: 'cpf'}, | |
{name: 'isDriver'}, | |
{name: 'birth'}, | |
{name: 'habilitacao'}, | |
]) | |
return ( | |
<div> | |
{data.map( ({name}) => | |
<div> | |
<input | |
key={name} | |
name={name} | |
type="text" | |
placeholder={name} | |
onChange={ (e) => setStats({nome: e.target.value}) } | |
onChange={ (e) => setStats({{name}: e.target.value}) } | |
/> | |
</div> | |
)} | |
{stats.nome} | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment