Last active
September 8, 2020 14:59
-
-
Save bengrunfeld/d912ac552d5e0d743523dfe5e9555828 to your computer and use it in GitHub Desktop.
Combine Formik with TypeScript and React-Select
This file contains hidden or 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
const schema = Yup.object({ | |
dogBreed: Yup.string().required("Required") | |
}) | |
const options = [ | |
{ value: "terrier", label: "Terrier" }, | |
{ value: "hound", label: "Hound" }, | |
{ value: "corgie", label: "Corgie" }, | |
]; | |
<Formik | |
initialValues={{ ...initialValues }} | |
validationSchema={schema} | |
onSubmit={(values, { setSubmitting }) => { | |
console.log("-->> Success: ", values); | |
setSubmitting(false); | |
}} | |
> | |
<Form> | |
<DropDown | |
label="What is your dogs breed?" | |
name="dogBreed" | |
options={options} | |
iid="dogBreed" | |
/> | |
</Form> | |
</Formik> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment