Skip to content

Instantly share code, notes, and snippets.

@fi11
Created May 8, 2018 12:42
Show Gist options
  • Select an option

  • Save fi11/8dcd37de653199791035b18e0ac2df87 to your computer and use it in GitHub Desktop.

Select an option

Save fi11/8dcd37de653199791035b18e0ac2df87 to your computer and use it in GitHub Desktop.
if (curr.type === 'validationError') {
const fieldName = curr.payload.name;
const error = curr.payload.error;
return acc.map((key, field) => {
if (key === fieldName && !field.getValue()) {
return field.setError(error);
}
return field;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment