UNPKG

@modular-forms/qwik

Version:

The modular and type-safe form library for Qwik

18 lines (17 loc) 525 B
import { getFieldStore } from './getFieldStore'; import { getInitialFieldStore } from './getInitialFieldStore'; /** * Initializes and returns the store of a field. * * @param form The form of the field. * @param name The name of the field. * @param initialState The initial state. * * @returns The reactive store. */ export function initializeFieldStore(form, name) { if (!getFieldStore(form, name)) { form.internal.fields[name] = getInitialFieldStore(name); } return getFieldStore(form, name); }