API

This library provides the following Final Form mutators. They are intended to mimic the array mutations available Array.prototype in JavaScript.

The name argument always refers to the field to be mutated.

form.mutators.concat

(name: string, value: Array<any>) => void

Concatenates an array at the end of the field array.

form.mutators.insert

(name: string, index: number, value: any) => void`

Inserts a value into the specified index of the field array.

form.mutators.move

(name: string, from: number, to: number) => void

Moves a value from one index to another index in the field array.

form.mutators.pop

(name: string) => any

Pops a value off the end of an field array. Returns the value.

form.mutators.push

(name: string, value: any) => void

Pushes a value onto the end of an field array.

form.mutators.remove

(name: string, index: number) => any

Removes a value from the specified index of the field array. Returns the removed value.

form.mutators.removeBatch

(name: string, indexes: Array<number>) => void

Removes the values at the specified indexes of the field array.

form.mutators.shift

(name: string) => any

Removes a value from the beginning of the field array. Returns the value.

form.mutators.swap

(name: string, indexA: number, indexB: number) => void

Swaps the position of two values in the field array.

form.mutators.unshift

(name: string, value: any) => void

Inserts a value onto the beginning of the field array.

form.mutators.update

(name: string, index: number, value: any) => void

Updates a value of the specified index of the field array.