issue: shouldUnregister: true
: watched value with defaultValues return undefined
when using conditional rendering or reset. (different from #10096)
#10180
-
Version Number7.43.7 Codesandbox/Expo snackhttps://codesandbox.io/s/compassionate-bell-e0ccls?file=/src/App.tsx Steps to reproduce
all of the above would be as same as the expected one with Expected behaviourThe result of step2 should be What browsers are you seeing the problem on?No response Relevant log outputNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
If |
Beta Was this translation helpful? Give feedback.
-
@bluebill1049 But I think the one who is out of expectation is In both of the cases, the return of |
Beta Was this translation helpful? Give feedback.
-
There is a lot going on with check input mounts or unmounts, I would probably recommend using unregister if your use case. |
Beta Was this translation helpful? Give feedback.
There is a lot going on with check input mounts or unmounts, I would probably recommend using unregister if your use case.
watch
API has the condition to check mount or unmount when you invoke reset if will remove all input references and wait until all inputs get re-render and remounted.