-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Side effects when validation fails? #56
Comments
I think what I'm suggesting if it'd make sense to return so it becomes: else {
UpdateWithSideEffects({
...state,
fields,
status: FormStatus.Editing,
submittedOnce: true,
},
({state, dispatch}) =>
state.input
->onFailedValidation,
)
}; |
@jchavarri Your suggestion makes sense to me 👍 Though I'd use a bit different name here b/c |
I will update |
I have this form that involves different screens, with routing between them etc. The state is global, and shared across screens (which are "dumb components").
I'm looking at re-formality as I think it could simplify a lot the current implementation (amazing work on the library!) but one thing I'm wondering is how to perform side effects on validation error.
In particular, I have to:
whenever validation fails.
I see there's only an
onSubmit
param to theuseForm
hook, would it be possible to addonFailedValidation
as well? Or is there another way to implement this kind of feature with re-formality?The text was updated successfully, but these errors were encountered: