Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.