Trigger validation after initial data is loaded #3700
Unanswered
Marcin-Kapusta
asked this question in
General
Replies: 1 comment 5 replies
-
|
Beta Was this translation helpful? Give feedback.
5 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.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to validate form as soon as initial data is loaded.
To set loaded data I'm using reset and to trigger validation I'm trying to use trigger()
In the result no errors are showing. If I wait for example 100ms and then call trigger then validation is working. What I'm doing wrong.
Also when defaultValues are set during useForm then trigger works as expected but in my case I want to simulate async loaded data so I'm using reset in the example below.
Here is the Sandbox: https://codesandbox.io/s/reack-hook-form-initial-validation-zrwxv
Cheers :)
Beta Was this translation helpful? Give feedback.
All reactions