@modular-forms/solid
Version:
The modular and type-safe form library for SolidJS
17 lines (16 loc) • 601 B
JavaScript
import { initializeFieldArrayStore } from './initializeFieldArrayStore';
/**
* Sets the store of a field array to the specified state.
*
* @param form The form of the field array.
* @param name The name of the field array.
* @param state The new state to be set.
*/
export function setFieldArrayState(form, name, state) {
const fieldArray = initializeFieldArrayStore(form, name);
fieldArray.startItems.set(state.startItems);
fieldArray.items.set(state.items);
fieldArray.error.set(state.error);
fieldArray.touched.set(state.touched);
fieldArray.dirty.set(state.dirty);
}