Skip to content

Commit 20ed157

Browse files
committed
refactor: improve useFormField error message for better clarity
1 parent dcc5420 commit 20ed157

File tree

1 file changed

+1
-1
lines changed
  • packages/components/src/remix-hook-form

1 file changed

+1
-1
lines changed

packages/components/src/remix-hook-form/form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const useFormField = () => {
1919
const fieldState = getFieldState(fieldContext.name, formState);
2020

2121
if (!fieldContext) {
22-
throw new Error('useFormField should be used within <FormField>');
22+
throw new Error('useFormField must be used within a <FormField> component. Ensure this hook is called from a component that is a child of FormField.');
2323
}
2424

2525
const { id, formItemId, formDescriptionId, formMessageId } = itemContext;

0 commit comments

Comments
 (0)