Next.js Discord

Discord Forum

How do i access providers in a page component?

Unanswered
Dogue Brasileiro posted this in #help-forum
Open in Discord
Dogue BrasileiroOP
guys i have a auth-provider.tsx file which provides the user data. How do i access it in a page component?
import { useAuth } from "@/app/providers/auth-provider";
import Nav from "../nav";

export default function DashboardPage() {
    const auth = useAuth()
    return (
        <>
            <Nav user={auth.user} />
        </>
    )
}

This doesn't seems to work

1 Reply

Dogue BrasileiroOP
I am guessing its because the auth-provider is client component
so how do i access it?