watch() called with an array returns the defaultValues for falsy values
See original GitHub issueWhen watch()
is called with an array of field names, it returns the defaultValues for fields their values are empty string or false
. It should returns empty values, not default values.
This behavior doesn’t occurs when watch()
is called with single field name or no arguments.
Here is an example code. https://codesandbox.io/s/react-hook-form-watch-defaultvalues-ucp22
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
useForm - watch - Simple React forms validation
This method will watch specified inputs and return their values. It is useful to render input value and for determining what to render...
Read more >How to change React-Hook-Form defaultValue with useEffect()?
Then call it with the user data after it's received: useEffect(() => { if (userData) ... You can remove the default values from...
Read more >Set Default Values in Power Apps - SharePoint - YouTube
This video is a step-by-step tutorial on how to set the default values of controls in Power Apps. We will set default values...
Read more >PHP 8.0: Named Parameters
Named parameters inherit the default values if not explicitly set at the ... The call_user_func_array() function will use they array keys as parameter...
Read more >react-hook-form/CHANGELOG.md at master - GitHub
useFieldArray ({ name: 'test', rules: { required: true, minLength: 2, maxLength: 10, ... improve checkboxes value determine by defaultValues.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
react-hook-form@3.22.2-beta.8
works fine in my project. Thank you!thanks, I have patched the bug: you can test out in this beta version:
react-hook-form@3.22.2-beta.8