question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

watch() called with an array returns the defaultValues for falsy values

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dkusanocommented, Aug 24, 2019

react-hook-form@3.22.2-beta.8 works fine in my project. Thank you!

1reaction
bluebill1049commented, Aug 24, 2019

thanks, I have patched the bug: you can test out in this beta version: react-hook-form@3.22.2-beta.8

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found