@modular-forms/qwik
Version:
The modular and type-safe form library for Qwik
22 lines (21 loc) • 548 B
JavaScript
import { getFieldStore } from './getFieldStore';
/**
* Returns the RAW state of the field.
*
* @param form The form of the field.
* @param name The name of the field.
*
* @returns The state of the field.
*/
export function getFieldState(form, name) {
const field = getFieldStore(form, name);
return field
? {
startValue: field.internal.startValue,
value: field.value,
error: field.error,
touched: field.touched,
dirty: field.dirty,
}
: undefined;
}