TypeError: Cannot read properties of null (reading 'control') #10120
-
I have this lib for my own projects, where I mostly export form components created with I am creating a next.js application on react 18 with nextjs 13, but in the old pages directory. When I try to use a
I am not sure what to do about it |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Please provide a codesandbox url to re-produce the issue. |
Beta Was this translation helpful? Give feedback.
-
I solved the problem by re-exporting the complete react-hook-form lib with: |
Beta Was this translation helpful? Give feedback.
-
I had the same problem, and exporting React Hook Form from your library doesn’t make sense. It increases the package size and slows down bundling. I fixed this by simply adding react-hook-form to peerDependencies. Hope this helps future users! |
Beta Was this translation helpful? Give feedback.
I solved the problem by re-exporting the complete react-hook-form lib with:
export * from "react-hook-form"
, adjusting my tsconfig so the types would get picked up:"include": [ "src", "node_modules/react-hook-form" ]
and then removing thereact-hook-form
lib from my main project and importinguseWatch
from my package instead ofreact-hook-form