feat(form): Adicionando o yup

This commit is contained in:
Savio Carvalho Moraes 2023-01-11 20:17:25 -03:00
parent 27934858f8
commit b470b756a3

View File

@ -1,5 +1,6 @@
import React from "react";
import { useFormik } from "formik";
import * as Yup from "yup";
import styles from "./formInput.module.scss";
const FormInput = () => {
@ -12,6 +13,14 @@ const FormInput = () => {
tel: "",
instagram: "",
},
validationSchema: Yup.object({
nome: Yup.string().label("Seu nome completo").required(),
email: Yup.string().email().required(),
cpf: Yup.string().required(),
nascimento: Yup.string().required(),
tel: Yup.string().required(),
instagram: Yup.string().required(),
}),
onSubmit: function (values) {
alert(`You are registered! Name: ${values.nome}. Email: ${values.email}. Profession: ${values.cpf}.
Age: ${values.nascimento}`);