Next.js Discord

Discord Forum

Struggling to keep a server component from turning into a client component

Unanswered
Ragnsan posted this in #help-forum
Open in Discord
I have this component where I select a an activeType and show a carousel of its items. The ProuductCard component fetches data so it needs to be a server component (and uses cookies). Since the ShoePickerSection component (see below) is a client component it turns the ProductCard into a client component as well. I thought I could solve this by moving the activeTypeName state into a context and moving the Select into its own component, but the problem is the mapping of the activeType's items.

Here I need to know which type is active in order render the correct items. But how do I do this? In other cases where I needed to have a server component nested inside of a client component I used the child prop to make it happen, but where I need to know which items to render so I can' just have a child (atleast I believe so).

Would greatly appreciate any help!

0 Replies