Skip to content

Instantly share code, notes, and snippets.

@amankkg
Last active August 4, 2017 16:13
Show Gist options
  • Save amankkg/b4bef84701f37208f8c5cede9d85832f to your computer and use it in GitHub Desktop.
Save amankkg/b4bef84701f37208f8c5cede9d85832f to your computer and use it in GitHub Desktop.
no-complex-logic-in-prop-types.js
const withErrors = shape({ hasErrors: oneOf([true]).isRequired, errors: arrayOf(string).isRequired })
const withoutErrors = shape({ hasErrors: oneOf([false]).isRequired, errors: arrayOf(string) })
const result = oneOfType([withErrors, withoutErrors])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment