Type error with Clerk, Just trying to use useUser()
Hey yall I'm having an error using the useUser function in my nextjs app router project. Its saying that useUser is not a function but I import it correctly. Im just so stumped.
![No description](https://cdn.answeroverflow.com/1194766030678020299/Screenshot_2024-01-10_at_2.08.49_PM.png)
![No description](https://cdn.answeroverflow.com/1194766031198093464/Screenshot_2024-01-10_at_2.11.49_PM.png)
![No description](https://cdn.answeroverflow.com/1194766031764340947/Screenshot_2024-01-10_at_2.13.03_PM.png)
6 Replies
Never mind I found the solution I guess because useUser is a client function you have to use the "use client" for the page
Solution
For SSR use:
the function you are trying to use isnt available inside next js
it is available inside normal react
if you are using next js consider looking at the docs for the right function
https://clerk.com/docs/references/nextjs/overview
Next.js and Clerk | Clerk
Learn how to use Clerk to quickly and easily add secure authentication and user management to your Next.js application.
I think you should rephrase your sentence because that makes it sound like you can't use clerk's hooks at all in all parts of nextjs projects.
thats why i forwarded the docs
Thanks yall yea I figured it out