Reinitialize initial form values #3326
Closed
kwameopareasiedu
started this conversation in
Feature requests
Replies: 2 comments 2 replies
-
The variable is called initialValue – it contains values that you've set initially. There is no reason to update these values. |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here's an sample of an update form which requires an object from an API to set initial values
From this example, we can see that the initial values depends on the value of
person
. However,person
is not initially defined and needs to be fetched from the an API. When the API resolves, I noticed that the initial values ofuseForm
does not update.I'd like to request a feature such that
useForm
can take a list of dependencies (like React'suseEffect
). The internals ofuseForm
(such asinitialValues
) should update when the dependencies update.Something along the lines of this:
PS: I'm aware I can use
form.setFieldValue
in auseEffect
to achieve the same thing, however if the form fields are a lot that can be quite inconvenient.Beta Was this translation helpful? Give feedback.
All reactions