When using Next.js, integrating Autoform causes crashes due to the import of FormProvider (from react-hook-form) within a server component.
Temporary Solution
I had to manually add "use client" at the top of autoform/utils.ts and autoform/AutoForm.tsx files to resolve the issue.
Explanation
Next.js defaults to server components, but contexts like FormProvider cannot be used in server components. Changing these components to client components by adding "use client" fixed the issue.
When using Next.js, integrating Autoform causes crashes due to the import of
FormProvider(fromreact-hook-form) within a server component.Temporary Solution
I had to manually add
"use client"at the top ofautoform/utils.tsandautoform/AutoForm.tsxfiles to resolve the issue.Explanation
Next.js defaults to server components, but contexts like
FormProvidercannot be used in server components. Changing these components to client components by adding"use client"fixed the issue.