Last active
September 19, 2017 19:01
-
-
Save jaredpalmer/4d239783b487f47955af7eb810a208fe to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Basic = () => | |
<div> | |
<h1>My Form</h1> | |
<p>This can be anywhere in your application</p> | |
<Formik | |
initialValues={{ email: '', password: '' }} | |
validate={values => { /* omitted for brevity */ }} | |
onSubmit={values => { /* omitted for brevity */ }} | |
render={({ values, errors, touched, handleChange, handleSubmit, isSubmitting }) => | |
<form onSubmit={handleSubmit}> | |
<input | |
type="email" | |
name="email" | |
onChange={handleChange} | |
value={values.email} | |
/> | |
{touched.email && errors.email && <div>{errors.email}</div>} | |
<input | |
type="password" | |
name="password" | |
onChange={handleChange} | |
value={values.password} | |
/> | |
{touched.password && errors.password && <div>{errors.password}</div>} | |
<button type="submit" disabled={isSubmitting}>Submit</button> | |
</form>} | |
/> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment