Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 10, 2020 09:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save velotiotech/cf07d5ee8bf004205491864aa09adc94 to your computer and use it in GitHub Desktop.
import React from 'react';
import { useFormik } from 'formik';
const SignupForm = () => {
const formik = useFormik({
initialValues: {
email: '',
},
onSubmit: values => {
alert(JSON.stringify(values, null, 2));
},
});
return (
<form onSubmit={formik.handleSubmit}>
<label htmlFor="email">Email Address</label>
<input
id="email"
name="email"
type="email"
onChange={formik.handleChange}
value={formik.values.email}
/>
<button type="submit">Submit</button>
</form>
);
};
export default SignupForm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment