From b470b756a36efd5d2526b137e59b4fd0edcfd856 Mon Sep 17 00:00:00 2001 From: Savio Date: Wed, 11 Jan 2023 20:17:25 -0300 Subject: [PATCH] feat(form): Adicionando o yup --- src/components/FormInput/FormInput.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/FormInput/FormInput.tsx b/src/components/FormInput/FormInput.tsx index f124742..037376f 100644 --- a/src/components/FormInput/FormInput.tsx +++ b/src/components/FormInput/FormInput.tsx @@ -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}`);