@modular-forms/qwik
Version:
The modular and type-safe form library for Qwik
16 lines (15 loc) • 520 B
JavaScript
import { Field, Form, FieldArray } from '../components';
import { useFormStore } from './useFormStore';
export function useForm(options) {
// Use form store
const form = useFormStore(options);
// Return form store and linked components
return [
form,
{
Form: (props) => Form({ of: form, action: options.action, ...props }),
Field: (props) => Field({ of: form, ...props }),
FieldArray: (props) => FieldArray({ of: form, ...props }),
},
];
}