Created
February 21, 2021 20:22
-
-
Save intojs/e856ea60dd204908aabf798ee5c26db7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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