final-form/react-final-form-arrays

Any way to emptyfy the array ?

IzaGz opened this issue · 2 comments

IzaGz commented

Request for the feqture!
We have shift, pop, remove, but any one can clear the whole array for making it empty?

I was facing the similar problem with removing multiple items. Using field.remove() in a loop wouldn't work properly. I just found a method called removeBatch() that is covered in https://final-form.org/docs/final-form-arrays/api.

So I'm using fields.removeBatch(indexArray) to remove multiple items from an array. I wonder if it is the correct way of doing it since it isn't mentioned in the React Final Form Arrays document