Skip to content

Instantly share code, notes, and snippets.

@Klerith
Created October 9, 2021 14:44
Show Gist options
  • Save Klerith/e773fb7c2d9e04da9bfae76d38492771 to your computer and use it in GitHub Desktop.
Save Klerith/e773fb7c2d9e04da9bfae76d38492771 to your computer and use it in GitHub Desktop.
Formik Email Validation
if (!values.email) {
errors.email = 'Required';
} else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) {
errors.email = 'Invalid email address';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment