Skip to content

Instantly share code, notes, and snippets.

@intojs
Created February 21, 2021 20:22
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 intojs/e856ea60dd204908aabf798ee5c26db7 to your computer and use it in GitHub Desktop.
Save intojs/e856ea60dd204908aabf798ee5c26db7 to your computer and use it in GitHub Desktop.
const withValidation = (state, field, value) => {
const changedState = {
...state,
fields: {
...state.fields,
[field]: {
...state.fields[field],
value,
},
},
};
return {
...changedState,
isValid: isNewsletterFormModelValid(changedState),
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment