Why do I get a "useForm is not a function" error when using React Hook forms in a Next JS project? #59483
-
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 18 replies
-
I was trying to figure this out too. Need to set |
Beta Was this translation helpful? Give feedback.
-
thank you . |
Beta Was this translation helpful? Give feedback.
-
I face palmed when reading this |
Beta Was this translation helpful? Give feedback.
-
here i used "use-client" and still got problem. 'use-client' type Inputs = { type Props = {} const Contact = (props: Props) => { const {register,handleSubmit} = useForm() const onSubmit: SubmitHandler = (formData) => { return (
|
Beta Was this translation helpful? Give feedback.
-
😅what a silly mistake idk where i got that from thank chief.🙏
…On Tue, 16 Apr 2024 at 01:03, Bartosz Kostrowiecki ***@***.***> wrote:
@Luyolop1 <https://github.com/Luyolop1> You should type use client, not
use-client. You don't need to put a hyphen in the middle.
—
Reply to this email directly, view it on GitHub
<#59483 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2B2TSS62SENLHNR33PESRTY5RMFJAVCNFSM6AAAAABAPTYQXSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TCMRTGQ3TI>
.
You are receiving this because you were mentioned.Message ID: <vercel/next
.***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thank you brother
…On Wed, 17 Apr 2024 at 16:24, Muhammad Najeeb Yusuf < ***@***.***> wrote:
You saved me a lot of time
Thanks
—
Reply to this email directly, view it on GitHub
<#59483 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2B2TSX2TRWZZVIL22LYR23Y52AZXAVCNFSM6AAAAABAPTYQXSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TCNBTHA3TK>
.
You are receiving this because you were mentioned.Message ID: <vercel/next
.***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
For me, even with 'use client' at the top, it's not working :( |
Beta Was this translation helpful? Give feedback.
-
In NextJS 14, when using useForm from React Hook Form, the component must be marked as a client component. To ensure this, add "use client"; at the top of your file. This directive ensures that the component is rendered on the client side, which is necessary for React Hook Form to function correctly. |
Beta Was this translation helpful? Give feedback.
I was trying to figure this out too. Need to set
'use client'