Skip to content
Discussion options

You must be logged in to vote

Hi,

You can do something called, poisoning to prevent accidental imports: https://nextjs.org/docs/getting-started/react-essentials#the-server-only-package

Also use client means that the JS that drives the component is sent to the client for hydration. There's a client-only poison you can use.

Everything is a server component by default.

I think the problem you have is that a use client component is directly importing your ImageWithPlaceholder - when a use client component enters the React tree, all of its direct children are client components. Otherwise, everything is a Server Component by default.

What you can do is use composition, at some layout/page level, using this pattern: https:…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jamesvclements
Comment options

jamesvclements May 24, 2023
Collaborator Author

@jcubic
Comment options

@icyJoseph
Comment options

@jcubic
Comment options

Answer selected by jamesvclements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants