Return the output of onValid
and onInvalid
when handleSubmit
returns
#8590
Unanswered
petercpwong
asked this question in
Ideas
Replies: 2 comments 7 replies
-
Did you see my proposal on the oringal feature reques? Let me know what do you think? |
Beta Was this translation helpful? Give feedback.
7 replies
-
It will be helpful on my side as well. Currently, I'm using refs as a dirty workaround. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently there is no way to inspect the output of the
onValid
oronInvalid
functions after it finishes running insidehandleSubmit
.Saving the output of
onValid
andonInvalid
and returning it afterhandleSubmit
returns would be immensely helpful.react-hook-form/src/logic/createFormControl.ts
Lines 1013 to 1067 in efd9195
One use case may be for another downstream hook to determine the next steps based on the output of
onValid
(eg. a Modal window hook that returns server data fromonValid
after it closes). Anything downstream running the function returned byhandleSubmit
is unable to inspect the output ofonValid
since whatever it returns gets swallowed.Example use case:
Beta Was this translation helpful? Give feedback.
All reactions