NorthwindNorthwind
← All posts

Adopting Server Components: What We Learned

Server Components moved data fetching off the client and shrank our JS — but the mental model took a minute.

Sofia Alvarez · 1 min read
Share

React Server Components let us fetch data on the server and ship zero JS for the parts that don't need interactivity.

The win

A product page that used to ship 60KB of fetching-and-rendering logic now ships almost nothing — the HTML arrives with the data already in it.

// Runs on the server; no client JS for this component
 
  const product = await db.product.find(id);
  return <h1>{product.name}</h1>;
}

The gotcha

The client/server boundary is real and unforgiving. A "use client" near the root pulls everything below it onto the client. We spent a week learning to push that boundary down to the leaves.

Share

More to read

Related posts