Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Form com React Hooks e Unform
import React from 'react';
import { Form, Input } from '@rocketseat/unform';
import { useSelector } from 'react-redux';
import { Container } from './styles';
export default function Profile() {
const profile = useSelector(state => state.user.profile);
function handleSubmit(data) {
console.tron.log(data);
}
return (
<Container>
<Form initialData={profile} onSubmit={handleSubmit}>
<Input name="name" placeholder="Nome completo" />
<Input name="email" placeholder="Seu endereço completo" />
<hr />
<Input
type="password"
name="oldPassword"
placeholder="Sua senha atual"
/>
<Input type="password" name="password" placeholder="Nova senha" />
<Input
type="password"
name="confirmPassword"
placeholder="Confirmação de senha"
/>
<button type="submit">Atualizar perfil</button>
</Form>
<button type="submit">Sair do Gobarber</button>
</Container>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.