useForm

Function: useForm()

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

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

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

TOnMount extends undefined | FormValidateOrFn<TFormData>

TOnChange extends undefined | FormValidateOrFn<TFormData>

TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnBlur extends undefined | FormValidateOrFn<TFormData>

TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnSubmit extends undefined | FormValidateOrFn<TFormData>

TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>

Parameters

opts?

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

Returns

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

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.