UNPKG

@modular-forms/react

Version:

The modular and type-safe form library for React

22 lines (21 loc) 653 B
import { getFieldArrayStore } from './getFieldArrayStore'; /** * Returns the RAW state of the field array. * * @param form The form of the field array. * @param name The name of the field array. * * @returns The state of the field array. */ export function getFieldArrayState(form, name) { const fieldArray = getFieldArrayStore(form, name); return fieldArray ? { startItems: fieldArray.startItems.peek(), items: fieldArray.items.peek(), error: fieldArray.error.peek(), touched: fieldArray.touched.peek(), dirty: fieldArray.dirty.peek(), } : undefined; }