mirror of
https://github.com/LukeHagar/form.git
synced 2025-12-06 12:27:45 +00:00
972 B
972 B
id, title
| id | title |
|---|---|
| createFormFactory | createFormFactory |
createFormFactory
export function createFormFactory<TFormData>(
opts?: FormOptions<TFormData>,
): FormFactory<TFormData>
A function that creates a new FormFactory<TFormData> instance.
opts- Optional form options and a
listenfunction to be called with the form state.
- Optional form options and a
FormFactory<TFormData>
A type representing a form factory. Form factories provide a type-safe way to interact with the form API as opposed to using the globally exported form utilities.
export type FormFactory<TFormData> = {
useForm: (opts?: FormOptions<TFormData>) => FormApi<TFormData>
useField: UseField<TFormData>
Field: FieldComponent<TFormData>
}
useForm- A custom hook that creates and returns a new instance of the
FormApi<TFormData>class.
- A custom hook that creates and returns a new instance of the
useField- A custom hook that returns an instance of the
FieldApi<TFormData>class.
- A custom hook that returns an instance of the
Field- A form field component.