useForm

Function: useForm()

ts
function useForm<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>(opts?): ReactFormExtendedApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
function useForm<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>(opts?): ReactFormExtendedApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;

Defined in: packages/react-form/src/useForm.tsx:163

A custom React Hook that returns an extended instance of the FormApi class.

This API encapsulates all the necessary functionalities related to the form. It allows you to manage form state, handle submissions, and interact with form fields

Type Parameters

TFormData

TFormData

TOnMount

TOnMount extends FormValidateOrFn<TFormData> | undefined

TOnChange

TOnChange extends FormValidateOrFn<TFormData> | undefined

TOnChangeAsync

TOnChangeAsync extends FormAsyncValidateOrFn<TFormData> | undefined

TOnBlur

TOnBlur extends FormValidateOrFn<TFormData> | undefined

TOnBlurAsync

TOnBlurAsync extends FormAsyncValidateOrFn<TFormData> | undefined

TOnSubmit

TOnSubmit extends FormValidateOrFn<TFormData> | undefined

TOnSubmitAsync

TOnSubmitAsync extends FormAsyncValidateOrFn<TFormData> | undefined

TOnDynamic

TOnDynamic extends FormValidateOrFn<TFormData> | undefined

TOnDynamicAsync

TOnDynamicAsync extends FormAsyncValidateOrFn<TFormData> | undefined

TOnServer

TOnServer extends FormAsyncValidateOrFn<TFormData> | undefined

TSubmitMeta

TSubmitMeta

Parameters

opts?

FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>

Returns

ReactFormExtendedApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>