Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Created May 12, 2019 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luandevpro/178c6f8583d25ed273e5d72e4292b710 to your computer and use it in GitHub Desktop.
Save luandevpro/178c6f8583d25ed273e5d72e4292b710 to your computer and use it in GitHub Desktop.
import React, { useState } from 'react';
import { Formik } from 'formik';
import FormField from './FormField';
function FormPro() {
const [values] = useState({ name: '', email: '' });
const handleSubmit = (values, { resetForm }) => {
console.log(values);
resetForm({
name: '',
email: '',
});
};
return (
<div>
<Formik enableReinitialize initialValues={{ ...values }} onSubmit={handleSubmit}>
{(props) => <FormField {...props} />}
</Formik>
</div>
);
}
export default FormPro;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment