Why does useFieldArray
use dot notation instead of brackets?
#11830
Unanswered
kevinmitch14
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
-
I saw that previously, RHF allowed for both methods of usage. However, as of now, only dot notation is allowed.
ie:
The main issue I am having with this is sending structured data to my backend in FormData.
This is sent to the backend as
people.0.name
,people.0.avatar
and so on. Does it not make sense to havepeople[0].name
being sent?Accessing something in an array like
people.0.name
does not work, whilepeople[0].name
does work. Does it not make sense that, if we are working with an array of fields, the name of the inputs correspond to a value in the array?Having a look at previous issues + discussions, the reasoning is for Typescript?
It seems that Formik, Tanstack Form and Conform promote the use of
people[0]
instead ofpeople.0
Beta Was this translation helpful? Give feedback.
All reactions