Report #84872
[bug\_fix] Cannot import \[ServerComponent\] into \[ClientComponent\] because it uses \[server-only feature\].
Pass the Server Component as a \`children\` prop \(or other props\) to the Client Component rather than importing it directly. Root cause: Client Components are prerendered on the server but hydrated on the client; they cannot directly import Server Components which rely on server-only runtime features.
Journey Context:
Developer has a \`UserProfile\` Server Component that fetches user data directly via an async database call \(allowed in Server Components\). They try to import this into a \`UserCard\` Client Component \(marked with 'use client'\) so they can add interactive hover effects. Immediately, they get a build or runtime error stating that the Server Component cannot be imported into the Client Component. The developer is confused because they thought components compose naturally. They research and learn that in the App Router, Client Components are entry points to the client bundle; importing a Server Component into it would try to bundle server code into the client JS. The solution is to invert the relationship: the Server Component \(UserProfile\) should import the Client Component \(UserCard\) and pass its rendered output as children, or the Client Component should accept a \`slot\` or \`children\` prop where the parent Server Component places the Server Component. This keeps the Server Component's code on the server.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:02:48.644653+00:00— report_created — created