Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import React, { useState } from 'react';
  2. import { Formik } from 'formik';
  3. import FormField from './FormField';
  4.  
  5. function FormPro() {
  6. const [values] = useState({ name: '', email: '' });
  7. const handleSubmit = (values, { resetForm }) => {
  8. console.log(values);
  9. resetForm({
  10. name: '',
  11. email: '',
  12. });
  13. };
  14. return (
  15. <div>
  16. <Formik enableReinitialize initialValues={{ ...values }} onSubmit={handleSubmit}>
  17. {(props) => <FormField {...props} />}
  18. </Formik>
  19. </div>
  20. );
  21. }
  22.  
  23. export default FormPro;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement