import { type UseFormGetFieldState } from "https://deno.land/x/netzo@0.5.63/deps/react-hook-form.ts";
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.
Examples
Example 1
Example 1
// 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 Parameters
TFieldValues extends FieldValues
definition: <TFieldName extends FieldPath<TFieldValues>>(name: TFieldName, formState?: FormState<TFieldValues>) => { invalid: boolean; isDirty: boolean; isTouched: boolean; error?: FieldError; }