Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

UseFormGetFieldState

This method will return individual field states. It will be useful when you are trying to retrieve the nested value field state in a typesafe approach.

@example
// those formState has to be subscribed
const { formState: { dirtyFields, errors, touchedFields } } = formState();
getFieldState('name')
// Get field state when form state is not subscribed yet
getFieldState('name', formState)

// It's ok to combine with useFormState
const formState = useFormState();
getFieldState('name')
getFieldState('name', formState)
type UseFormGetFieldState<TFieldValues extends FieldValues> = <TFieldName extends FieldPath<TFieldValues>>(name: TFieldName, formState?: FormState<TFieldValues>) => {
invalid: boolean;
isDirty: boolean;
isTouched: boolean;
error?: FieldError;
}
;

§Type Parameters

§
TFieldValues extends FieldValues
[src]

§Type

§
<TFieldName extends FieldPath<TFieldValues>>(name: TFieldName, formState?: FormState<TFieldValues>) => {
invalid: boolean;
isDirty: boolean;
isTouched: boolean;
error?: FieldError;
}
[src]