FieldArrayRenderProps

Represents the props that are passed to the component which is rendered by FieldArray.

NameTypeDefaultDescription

children

any

Represents the children that are passed to the FieldArray.

modified

boolean

Indicates if the field is modified. The modified state is set to true when the onChange callback for the current field is called for first time.

name

string

The name of the field in the Form state.

onInsert

(options: { index: number; value: any; }) => void

A callback to insert value at given index of the array.

onMove

(options: { nextIndex: number; prevIndex: number; }) => void

A callback to move a value from one index to another. Useful for drag and drop reordering.

onPop

() => any

A callback to remove a value from the end of the array. The value is returned.

onPush

(options: { value: any; }) => void

A callback to add a value to the end of the array.

onRemove

(options: { index: number; }) => any

A callback to remove a value from given index of the array.

onReplace

(options: { index: number; value: any; }) => void

A callback to replace value at given index of the array.

onUnshift

(options: { value: any; }) => number

A callback to add a value to the beginning of the array.

touched

boolean

Indicates if the field is touched. The touched state is set to true when the onBlur callback is called.

valid

boolean

A calculated property based on whether validationMessage is present and the touched state is set to true.

validationMessage

"null" | string

Represents the error message that is returned by the validator. The FieldArray is considered valid if the validationMessage field is empty.

value

any

Represents the current value of the FieldArray (see example).

visited

boolean

Indicates if the field is visited. The visited state is set to true when the onFocus callback is called.