You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm a bit confused by the handleSubmit documentation here which states that handleSubmit "will receive the form data if form validation is successful." Is that actually correct? It seems that the second parameter it takes, i.e. the SubmitErrorHandler, is for when validation fails. I wasted a good bit of time trying to figure this out because I thought the SubmitErrorHandler was for errors thrown from the first parameter, SubmitHandler. I know the page later says, "handleSubmit function will not swallow errors that occurred inside your onSubmit callback" but that didn't clarify when it actually gets called.
I'm new to react-hook-form so maybe I'm misunderstanding but it seems like two changes to the docs would be good:
Update the first line of text to say that "handleSubmit will receive the form data and call the SubmitHandler if validation succeeds, otherwise it will call the SubmitErrorHandler".
Add a line to the "SubmitErrorHandler" description saying that it is explicitly for handling validation errors.
Curious to hear if I'm misunderstanding or if others find the docs incorrect as well. Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm a bit confused by the handleSubmit documentation here which states that handleSubmit "will receive the form data if form validation is successful." Is that actually correct? It seems that the second parameter it takes, i.e. the SubmitErrorHandler, is for when validation fails. I wasted a good bit of time trying to figure this out because I thought the SubmitErrorHandler was for errors thrown from the first parameter, SubmitHandler. I know the page later says, "handleSubmit function will not swallow errors that occurred inside your onSubmit callback" but that didn't clarify when it actually gets called.
I'm new to react-hook-form so maybe I'm misunderstanding but it seems like two changes to the docs would be good:
Curious to hear if I'm misunderstanding or if others find the docs incorrect as well. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions