Replies: 1 comment 2 replies
-
hey, @bbrinx thanks a lot for your feedback. I think I can summary this and explain to you the rational behind. as you know RHF is based on uncontrolled forms, such as |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, thank you a bunch for this library, so far it's been very pleasant to use! I would like to bring up an issue I've been having lately to see if there's something I'm missing.
After updating to the latest react-hook-form version I am seeing warning messages for not providing default values for all form fields. What's the motivation behind adding warning messages for this? What are the downsides of not providing a default value for a field?
From my perspective this adds a lot of noise. There are two main scenarios I can think of in which a form doesn't need default values passed into the
useForm
hook:reset
. I now have to create a defaultValues object defining every field as null, just for it to be overwritten once the data is loaded.It doesn't seem necessary set the defaultValues in either of these cases. And yet we will get a warning message for every field of that form.
Of course there might be a good reason for the library to enforce that behavior which I am not aware of. Or I am misunderstanding how to use defaultValues. But as of now, having to add default values to every form has decreased my developer experience with react-hook-form.
Beta Was this translation helpful? Give feedback.
All reactions