You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been following the documentation for Form Composition but trying to make a reusable array component has thrown a wrench in things. I want to make a simple component for flat arrays of strings, but even before extracting my array code into a new component, the subfield name doesn't want to accept a variable:
In the above, typescript complains about name={`${field.name}[${i}]`} but not name={`people[${i}]`}. Can you offer any guidance into how I can make a reusable component for arrays that can make use of the form and field context without having to explicitly write out the name strings? Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I've been following the documentation for Form Composition but trying to make a reusable array component has thrown a wrench in things. I want to make a simple component for flat arrays of strings, but even before extracting my array code into a new component, the subfield name doesn't want to accept a variable:
In the above, typescript complains about
name={`${field.name}[${i}]`}
but notname={`people[${i}]`}
. Can you offer any guidance into how I can make a reusable component for arrays that can make use of the form and field context without having to explicitly write out the name strings? Thanks!Beta Was this translation helpful? Give feedback.
All reactions