react-final-form-arrays
react-final-form-arrays copied to clipboard
Fields names getter
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
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.