Replies: 2 comments
-
can you reproduce this in a codesandbox? |
Beta Was this translation helpful? Give feedback.
0 replies
-
In case it helps anyone, I managed to work around this by calling |
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
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to fully reset the form state after a successful submission. In particular, with the defaults for
mode
andreValidateMode
(onSubmit
,onChange
respectively), after a successful form submission, validation should only occur again withonSubmit
rather thanonChange
.However,
reset()
in onSubmit as below doesn't seem to achieve this -- it seems to reset the form beforeisSubmitted
is set to true and beforesubmitCount
is incremented, which then causes validation to continue to occur withonChange
rather thanonSubmit
. So, after a successful submission,submitCount == 1
andisSubmitted == true
, despite the reset.Could someone point me towards the right way to achieve this behavior? I also tried something like
onSubmit={ handleSubmit(onSubmit)(); reset(); }
but that of course resets after every submission rather than only successful ones.Beta Was this translation helpful? Give feedback.
All reactions