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.

Revisions

  1. Klerith created this gist Oct 9, 2021.
    5 changes: 5 additions & 0 deletions formik-email-validation.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    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';
    }