Replies: 7 comments
-
|
Beta Was this translation helpful? Give feedback.
-
When I read the documentation it seems to imply that |
Beta Was this translation helpful? Give feedback.
-
You can configure your useForm({
values,
+ resetOptions: {
+ keepDefaultValues: true
+ }
}) Although, I'm not sure if the |
Beta Was this translation helpful? Give feedback.
-
Thanks! I'll try it out! Still seems a bit counter intuitive that you'd ever overwrite the |
Beta Was this translation helpful? Give feedback.
-
The The most prominent use-case would be an edit form where the dataset for an entity has already been established. You can reference the |
Beta Was this translation helpful? Give feedback.
-
I am not sure I understand the need for both My use-case was a simple filter for a list on a page:
In the second case I still want to be able to reset the filter to the default values (i.e. clear the form). I can solve it by passing the default values to the |
Beta Was this translation helpful? Give feedback.
-
This is a nice way to look at it but then why would we have both When you separate the form data into two, I expect Also, let's say I have a field select component, its default/placeholder option value could be any of these options below:
I might wanna set the So, by overriding |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7
Codesandbox/Expo snack
https://codesandbox.io/s/eager-ganguly-kflwcy?file=/src/App.tsx
Steps to reproduce
useForm
, one with onlydefaultValues
, and one with bothdefaultValues
andvalues
.defaultValues
are overwritten by thevalues
prop.Set firstName to "UPDATED"
button to update the value of the second form. Note that thedefaultValue
seems to remain unchanged as expected.Expected behaviour
Providing the
values
prop touseForm
should not overwrite thedefaultValues
.What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions