Is it legal to pass values without defaultValues into useForm? #13306
-
|
I have the following use-case of RHF: According to documentation Please have a look at this example and explain what is wrong with it. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
|
@helmax-y (FYI) |
Beta Was this translation helpful? Give feedback.
This can be done using just
valueswithoutuseEffect. See this CodeSandbox. Ifvaluesis initiallyundefined, you will need to providedefaultValues. See this CodeSandbox for an example that does not includedefaultValues.You're CodeSandbox is using a really old version of RHF (version
7.4.1from 2021). The CodeSandboxes above use the latest version7.71.2and everything works as expected. When the server data is changed, the form updates to reflect the new values.