Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joaovitorzv/9becc856a0d2a6e435658fab2b538502 to your computer and use it in GitHub Desktop.
Save joaovitorzv/9becc856a0d2a6e435658fab2b538502 to your computer and use it in GitHub Desktop.
export default function Register() {
const emailsAlreadyInUse = [];
function handleSubmit(values, {
setSubmitting,
setFieldError
}) {
setTimeout(() => {
if (values.email === 'teste123@teste.com') {
setFieldError('email', 'email already registered');
emailsAlreadyInUse.push(values.email);
setSubmitting(false);
} else {
alert(JSON.stringify(values))
setSubmitting(false);
}
}, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment