Clerk Webpack Importing Error
I'm trying to use the
useUser()
function provided with Clerk, however I'm getting this error whenever I try to compile it:
Here's the code:
4 Replies
Hi, did you find the solution for this? I have the same problem when code along with theo's T3 video
Yes, but I'm not entirely sure what fixed it. Here's what looks different from my old code;
-
const { user } = useUser()
;
- "use client"
directive at the top
- if (!user) { return null }
before the actual return statement
Hopefully that fixes it for youSolution
Add
"use client"
works on my case
Thanks for the reply man! 🤝No problem!