Im using final-form/react-final-form-arrays library is there a way to sort by most recent field appearing first. The FieldArray component has the fields prop which is array like but does not have a reverse function. So each time I add a new field e.g fields.push({newObject}) I want that rendered component to be at the top of the list. Anyone know how to make this work?

1

There are 1 best solutions below

0
On BEST ANSWER

Yes, there is a way to add values to the top instead of the bottom.

Simply replace

fields.push({});

with

fields.unshift({});

More details can also be found in the root readme: https://github.com/final-form/react-final-form-arrays