How to clear object with setValue properly? #10542
Unanswered
Plugo-SeongGonGo
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I think you could try: reset |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an object field that could be filled with an API response.
If the response has been changed, I want to clear the object, so I called setValue like
setValue('data', {})
.But object values still remain if it is accessed by a nested path, like
const { field } = useController({ control, name:
data.${id}})
.Should I call
setValue
for every nested path, or is there a better way to clear an object?Sandbox: https://codesandbox.io/s/keen-alex-69cvl2
Beta Was this translation helpful? Give feedback.
All reactions