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
In the document, it explains that the defaultValue of useWatch is used before the initial render. I understand that after the initial render, the value will change based on the defaultValues of useForm.
However, after checking the implementation, I found that the defaultValue in useWatch always takes higher priority.
When both defaultValues from useForm and defaultValue from useWatch are set, wouldn’t it be more appropriate to use defaultValues from useForm? Is there any benefit to using defaultValue in useWatch?
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.
Uh oh!
There was an error while loading. Please reload this page.
-
In the document, it explains that the defaultValue of useWatch is used before the initial render. I understand that after the initial render, the value will change based on the defaultValues of useForm.
react-hook-form/src/logic/createFormControl.ts
Lines 553 to 572 in 22287a0
However, after checking the implementation, I found that the defaultValue in useWatch always takes higher priority.
When both defaultValues from useForm and defaultValue from useWatch are set, wouldn’t it be more appropriate to use defaultValues from useForm? Is there any benefit to using defaultValue in useWatch?
Beta Was this translation helpful? Give feedback.
All reactions