Created
June 10, 2020 09:30
-
-
Save velotiotech/cf07d5ee8bf004205491864aa09adc94 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'; | |
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