Skip to main content

Oct 2026 · Guide · ~8 min read

React Server Components vs Client Components — Part 2

By Safdar Ali — frontend engineer, Bengaluru

Part 1 is the decision: server by default, client on the leaf. Part 2 is what breaks after the team knows that rule and still ships a page that is secretly one large client component.

Pass server content as children

A client wrapper cannot import a Server Component. It can render one that was passed in as children, because the server already rendered that subtree.

// ClientShell.tsx
"use client";
export function ClientShell({ children }) {
  const [open, setOpen] = useState(true);
  if (!open) return null;
  return <section>{children}</section>;
}

// page.tsx — still a Server Component
export default async function Page() {
  const post = await getPost();
  return (
    <ClientShell>
      <article>{post.title}</article>
    </ClientShell>
  );
}

If you move the article into the client file to "keep it together," the fetch either becomes a client fetch or the whole page picks up the directive. That is the regression I review for.

Actions stay on the server

A client form can call a server action. The action is not a reason to mark the page as a client component. Validate on the server. The button's pending state is the client's job.

Three mistakes from the first refactor

  1. Putting the directive on the layout so one menu can use state.
  2. Importing a server-only module into a client file and then deleting the server fetch to make the build pass.
  3. Passing functions or class instances as props across the boundary. Pass data, or pass children.

Measure the client bundle after the split. A page that still downloads the whole tree did not get a boundary. It got a comment.

If this helped you

I publish free tutorials and write-ups like this in my spare time — no paywall on the guides. If it saved you an afternoon of trial and error, you can support the work:

More guides on safdarali.in — same author, production-focused.

"Talk is cheap. Show me the code."