Created
February 11, 2021 19:18
-
-
Save matheusml/47b3ff2c5857141b09ff585a8d62f298 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { useFormik } from "formik"; | |
function App() { | |
const formik = useFormik({ | |
initialValues: { | |
name: "", | |
email: "", | |
}, | |
onSubmit: (values) => { | |
// do something with the form values | |
}, | |
}); | |
const { getFieldProps, handleSubmit } = formik; | |
return ( | |
<form onSubmit={handleSubmit}> | |
<input {...getFieldProps("name")} id="name" /> | |
<input {...getFieldProps("email")} id="email" /> | |
</form> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment