Last active
March 16, 2021 03:24
-
-
Save scottgamer/8510fc51bc4ffea36fc37232d985eefd to your computer and use it in GitHub Desktop.
form with error messages
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
| <Formik | |
| initialValues={initialValues} | |
| onSubmit={onSubmit} | |
| validationSchema={validationSchema} | |
| > | |
| <Form className="form"> | |
| <label htmlFor="firstName" className="form__label"> | |
| First Name | |
| </label> | |
| <Field | |
| name="firstName" | |
| type="text" | |
| className="form__input" | |
| placeholder="First Name" | |
| /> | |
| <ErrorMessage | |
| name="firstName" | |
| component="span" | |
| className="form__error" | |
| /> | |
| <label htmlFor="lastName" className="form__label"> | |
| Last Name | |
| </label> | |
| <Field | |
| name="lastName" | |
| type="text" | |
| className="form__input" | |
| placeholder="Last Name" | |
| /> | |
| <ErrorMessage | |
| name="lastName" | |
| component="span" | |
| className="form__error" | |
| /> | |
| <label htmlFor="email" className="form__label"> | |
| </label> | |
| <Field | |
| name="email" | |
| type="text" | |
| className="form__input" | |
| placeholder="Email" | |
| /> | |
| <ErrorMessage name="email" component="span" className="form__error" /> | |
| <button type="submit" className="btn"> | |
| Submit! | |
| </button> | |
| </Form> | |
| </Formik> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment