Why do I need to call useFieldArray's append/prepend with arguments? #11134
Unanswered
mlistemann
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I find myself in a scenario where I would like to call
prepend()
without any arguments. It should rather use whatever is the current defaultValue of the correspondinguseForm
.The parent component that introduces
useForm
defines some more or less empty defaultValue object. However, I'm going to update the default values in auseEffect
withreset
after data has been received from an API. Instead of passing a new property like "updatedDefaultValues" down to the child component where I useprepend
orappend
, I'm wondering why it wouldn't be possible to just call them with the current default values that are registered withuseForm
?Imagine the code looking somewhat like this:
Beta Was this translation helpful? Give feedback.
All reactions