How to delete/reset specific field? #11513
Unanswered
razb-viola
asked this question in
Q&A
Replies: 0 comments
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 have a select box component which allows the user to choose from list of options.
For example: colors can be red, green and blue.
Now I want to enable a clear button so if regrets and decide not to pick a color at all I don't have any ability to do that.
Only what I can to do is:
resetField('color', '')
which is not clearing the field but assign some string. I want to entirely delete this property from the object - as just as was if the user hasn't selected it at all and leaved it blanked from first of all.Note: If I define no second parameter in the resetField, it just doesn't work.
How can it be achieved using react hook form?
Beta Was this translation helpful? Give feedback.
All reactions