Created
October 3, 2019 15:13
-
-
Save vigneshwaran-chandrasekaran/39d7d978242ccc8182153df145edbb3b to your computer and use it in GitHub Desktop.
Formik with render props
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
// https://medium.com/@rossbulat/react-forms-with-formik-hocs-and-functional-components-df394afd2039 | |
// defining a form within <Formik /> | |
const FormikForm = () => | |
<Formik | |
... | |
onSubmit={() => {...}} | |
validate={() => {...}} | |
render={ | |
({ handleSubmit, | |
handleChange, | |
handleBlur, | |
values, | |
errors | |
}) => { | |
<form onSubmit={handleSubmit}> | |
<Field | |
name="email" | |
component='input' | |
/> | |
... | |
</form> | |
} | |
} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment