Next.js Discord

Discord Forum

Context API with Server Components

Answered
Bombay-duck posted this in #help-forum
Open in Discord
Bombay-duckOP
Hi. I’m working on a client project in React/Next. This isn’t my usual framework of choice. I normally use Svelte or Solid. So, I’ve got a question.

I noticed that React’s Context API is a client-side only state management tool. Is there a way I can use the context API within server components?

I’m using the app directory btw.

Thanks for the help.
Answered by <Milind ツ />
No, to use context API, hooks, you have to mark a component as client component
View full answer

3 Replies

Bombay-duckOP
Bump
No, to use context API, hooks, you have to mark a component as client component
Answer
Bombay-duckOP
Rip. Alright. Thanks.