Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement