useField

Function: useField()

ts
function useField<TParentData, TName, TFieldValidator, TFormValidator, TData>(opts): FieldApi<TParentData, TName, TFieldValidator, TFormValidator, TData> & ReactFieldApi<TParentData, TFormValidator>
function useField<TParentData, TName, TFieldValidator, TFormValidator, TData>(opts): FieldApi<TParentData, TName, TFieldValidator, TFormValidator, TData> & ReactFieldApi<TParentData, TFormValidator>

A hook for managing a field in a form.

Type Parameters

TParentData

TName extends string | number

TFieldValidator extends undefined | Validator<DeepValue<TParentData, TName>, unknown> = undefined

TFormValidator extends undefined | Validator<TParentData, unknown> = undefined

TData = DeepValue<TParentData, TName>

Parameters

opts: UseFieldOptions<TParentData, TName, TFieldValidator, TFormValidator, TData>

An object with field options.

Returns

FieldApi<TParentData, TName, TFieldValidator, TFormValidator, TData> & ReactFieldApi<TParentData, TFormValidator>

The FieldApi instance for the specified field.

Defined in

useField.tsx:50

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.