Sort fields
of useFieldArray
#11695
Unanswered
Haschikeks
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
-
Hey 👋,
how would one be able to sort the fields from a
useFieldArray
?For example, I have the following type for the fields
And I want to sort the inputs by the
key
property. My first approach of just doing something likehad a weird behaviour.
Codesandbox
If you add all 4 translations, remove the first one and then add the first one again, you can see, that the labels are correctly ordered, but the values in the inputs are not "aligned".
Submitting the form has the correct data.
Do I have to use the
insert
function fromuseFieldArray
and find the correct spot?My goal is just to have a bit of visual clarity for the user.
Beta Was this translation helpful? Give feedback.
All reactions