Replies: 1 comment
-
Similar issue, this helped me |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In our app we have a form builder where the structure of the form is dynamic. In other words, we only know the number of fields in the form and their names at runtime.
Furthermore, one of the form builder's fields is a table, which has a variable number of rows. A user could include several such table fields in a form.
The form is defined along the lines of
Very simplified, the rendering looks like:
The question is how to use react-hook-form to model
TableField
. In principle we'd want a dynamic number of calls touseFieldArray()
, like so:Then we'd do
This has (at least) two issues I can see:
useFieldArray()
(docs foruseFieldArray
say: "Note: Do not support dynamic name.")How would you model this using react-hook-form?
Beta Was this translation helpful? Give feedback.
All reactions