Fields names getter
omerman opened this issue · 1 comments
omerman commented
Hey, say I have this code:
type FormValues = {
x: [{id: number, value: string}]
}
const { fields } = useFieldArray(
"x",
{
isEqual,
// re-render uppon array values change
subscription: { value: true },
}
);
Now sometimes I don't need to use fields.map, say I want to render the item in the 5th cell, assuming I know it exists..
How would I get the prefix name of the cell? surely I can write "x[5].value", but I wanted something like ${field.names[5]}.value also maybe instead of fields.map, make it fields.names.map
Great library, thank you for final-form & react-final-form & this plugin :),
looking forward for your response
omerman commented
Thought about it a bit more, maybe an api such as fields.get(5) that will return the string name prefix.
since fields.names[index]/fields.names.map may break the current behavior.