We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6e3a93 commit 513986dCopy full SHA for 513986d
src/components/form/form-field-error.tsx
@@ -7,7 +7,7 @@ import {
7
FieldPath,
8
FieldValues,
9
get,
10
- useFormContext,
+ useFormState,
11
} from 'react-hook-form';
12
13
import { cn } from '@/lib/tailwind/utils';
@@ -43,9 +43,7 @@ export const FormFieldError = <
43
TFieldValues,
44
TName
45
> | null>(FormFieldControllerContext as ExplicitAny);
46
- const {
47
- formState: { errors },
48
- } = useFormContext<TFieldValues, TName>();
+ const { errors } = useFormState<TFieldValues>();
49
const control = 'control' in props ? props.control : controllerCtx?.control;
50
const name = 'name' in props ? props.name : controllerCtx?.name;
51
0 commit comments