Skip to content

Instantly share code, notes, and snippets.

@matheusml
Created February 11, 2021 19:18
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 matheusml/47b3ff2c5857141b09ff585a8d62f298 to your computer and use it in GitHub Desktop.
Save matheusml/47b3ff2c5857141b09ff585a8d62f298 to your computer and use it in GitHub Desktop.
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