Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vigneshwaran-chandrasekaran/39d7d978242ccc8182153df145edbb3b to your computer and use it in GitHub Desktop.
Save vigneshwaran-chandrasekaran/39d7d978242ccc8182153df145edbb3b to your computer and use it in GitHub Desktop.
Formik with render props
// 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