Skip to content

Instantly share code, notes, and snippets.

@kino6052
Created November 20, 2020 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kino6052/bc3d4fbdf383a128edf4c2dd176932a5 to your computer and use it in GitHub Desktop.
Save kino6052/bc3d4fbdf383a128edf4c2dd176932a5 to your computer and use it in GitHub Desktop.
Formik isPristine
const isPristine = (
fieldName: string | string[],
touched: FormikTouched<FormikValues>
) =>
[fieldName]
.flatMap((fieldName) => fieldName)
.every((fieldName) => !touched[fieldName]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment