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
No description
No description
Solution:
For SSR use: ```ts import { auth } from '@clerk/nextjs'; ...
Jump to solution
6 Replies
LUNA
LUNA10mo ago
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
KO
KO10mo ago
For SSR use:
import { auth } from '@clerk/nextjs';

const Home = async () => {
const { user } = auth();
...
}
import { auth } from '@clerk/nextjs';

const Home = async () => {
const { user } = auth();
...
}
kaleembhatti
kaleembhatti10mo ago
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.
Heekun
Heekun10mo ago
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.
kaleembhatti
kaleembhatti10mo ago
thats why i forwarded the docs
LUNA
LUNA10mo ago
Thanks yall yea I figured it out
Want results from more Discord servers?
Add your server