Next.js Discord

Discord Forum

Context & Server Components

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
When consuming context within a component, does it have to be marked as a client component? This is something like an AuthButton that I want to use my AuthProvider in, but I get the following error: ⨯ TypeError: (0 , _contexts_AuthProvider__WEBPACK_IMPORTED_MODULE_1__.useAuth) is not a function"

The context itself is set as a client component, and wraps the children in the RootLayout component
Answered by Ray
yes the AuthButton need to be client component in order to use the useAuth hook
View full answer

2 Replies