Skip to main content
FutureStack
Web & Edge Runtime
•20 min read•Last Verified: 2026-01-16

React Server Components vs. SSR: Why They Solve Completely Different Problems

Clarify the distinct roles of SSR and RSC. SSR handles initial HTML delivery, while RSC removes server-only code from client bundles, enabling efficient.

Mubashir Arham

Mubashir Arham

Founder & Principal Systems Architect

React Server Components vs. SSR: Why They Solve Completely Different Problems
Important

[!IMPORTANT] Direct Answer (AIEO Summary): Server-Side Rendering (SSR) generates initial HTML on the server so users see a page quickly, but the browser still has to download and run 100% of your React JavaScript to hydrate the page. React Server Components (RSC) execute exclusively on the server and send zero component JavaScript to the browser. They are not competitors: SSR gives you an instant first paint on initial page load, while RSC permanently removes server-only code from your client bundle and lets you refetch fresh server UI on navigation without losing client state.

Published as Part 2 of the 10-Part FutureStack React Server Components Deep-Dive Series. Every code example, architecture diagram, and interactive React widget below is written for production React 19 & modern full-stack engineering teams.

1. The Biggest Misconception in Modern React

Many developers hear "React Server Components" (RSC) and immediately think it's just a new version of Server-Side Rendering (SSR). This is the biggest misconception in modern React development. It's easy to fall into this trap because both approaches involve rendering components on the server. But they solve fundamentally different problems.

Traditional SSR focuses on delivering a complete HTML document to the browser for the initial page load. This improves perceived performance and SEO. RSC, on the other hand, is about fundamentally changing where and how your components run and fetch data, throughout the entire application lifecycle. It's a new architectural primitive, not just a rendering optimization.

Think of it this way: SSR is like a server sending you a fully baked cake. You get it fast, but you still need to wait for it to cool down before you can eat it (hydration). React Server Components are more like a server sending you a custom cake mix with some pre-made ingredients. The server handles the hard parts, and your browser just finishes assembling the interactive pieces. This distinction is crucial for building performant, maintainable applications today.

Client-Side Rendering (CSR): The Interactive Baseline

Before we look at server-side solutions, let's establish the baseline: Client-Side Rendering (CSR). This is how most single-page applications (SPAs) have worked for years. When you visit a CSR-powered site, your browser first downloads a minimal HTML file. This HTML file is mostly empty, containing just a <div id="root"> or similar.

Next, your browser downloads a large JavaScript bundle. This bundle contains all your React components, logic, and data fetching instructions. Once the JavaScript loads and executes, React takes over. It then builds your entire application UI directly in the browser, fetching any necessary data from APIs.

The main benefit of CSR is its simplicity for developers. You write all your logic in JavaScript, and everything runs in the browser. After the initial load, navigation between pages is very fast because the browser doesn't need to re-download HTML. It just updates parts of the DOM.

However, CSR has significant downsides. The user sees a blank page until the JavaScript bundle finishes downloading and executing. This leads to slow Time to First Contentful Paint (FCP) and Time to Interactive (TTI). Search engines also struggle with CSR, as they have to execute JavaScript to see the content, which isn't always reliable. For users on slow networks or low-power devices, CSR can provide a frustrating experience.

src/app/products/page.tsx
'use client'; // This directive marks this as a Client Component.

import { useState, useEffect } from 'react';

interface Product {
  id: string;
  name: string;
  price: number;
}

export default function ProductsPageCSR() {
  const [products, setProducts] = useState<Product[]>([]); // State to hold fetched product data
  const [loading, setLoading] = useState(true); // Loading state for UX

  useEffect(() => {
    async function fetchProducts() {
      setLoading(true);
      // Data fetching happens entirely in the browser after JS loads
      const response = await fetch('/api/products');
      const data = await response.json();
      setProducts(data);
      setLoading(false);
    }
    fetchProducts();
  }, []); // Run once on component mount

  if (loading) {
    return <p>Loading products...</p>; // Displayed only after JS executes
  }

  return (
    <div>
      <h1>Our Products (CSR)</h1>
      <ul>
        {products.map((product) => (
          <li key={product.id}>
            {product.name} - ${product.price.toFixed(2)}
          </li>
        ))}
      </ul>
      <p>This page loaded its data entirely in your browser.</p>
    </div>
  );
  // The initial HTML from the server would be almost empty for this component.
}

In this CSR example, the 'use client' directive is explicit, though for a pure CSR app without RSC, it's implied. Notice the useEffect hook: the data fetch only starts after the component has mounted in the browser. This means the user sees "Loading products..." or a blank screen until the network request completes.

Server-Side Rendering (SSR): The Initial Load Optimizer

Server-Side Rendering (SSR) emerged as a solution to CSR's initial load problems. With SSR, the server doesn't just send an empty HTML shell. Instead, the server runs your React components once, generates the full HTML output for that page, and sends that HTML to the browser.

When the browser receives this HTML, it can immediately display the content. This significantly improves Time to First Contentful Paint (FCP), as the user sees meaningful content much faster. It also helps with SEO because search engine crawlers receive fully rendered HTML without needing to execute JavaScript. This makes indexing your content more reliable.

However, SSR introduces its own set of challenges. While FCP is fast, Time to Interactive (TTI) can still be slow. After the browser receives the HTML, it still needs to download the JavaScript bundle. Once the JavaScript loads, React performs a process called "hydration." During hydration, React "attaches" itself to the existing server-generated HTML, making it interactive. Until hydration completes, the page might look ready, but user interactions (like clicking buttons) won't work. This can lead to a frustrating "uncanny valley" experience.

Traditional SSR also meant that all data fetching for a page had to complete on the server before any HTML could be sent. This could lead to a slow Time to First Byte (TTFB) if your data fetches were slow. You can learn more about TTFB and its importance on the web.dev Time to First Byte (TTFB) Guide.

To combat slow TTFB, a technique called Streaming SSR became popular. With Streaming SSR, the server doesn't wait for all data to fetch. Instead, it sends HTML to the browser in chunks as it's generated. This allows the browser to start rendering parts of the page even before all data is ready, further improving perceived performance. This is a significant step forward, but the core challenge of client-side hydration for interactivity remains.

Architecture Note

[!NOTE] Hydration is a critical concept. In both traditional SSR and Streaming SSR, the server sends HTML. But for that HTML to become interactive (e.g., respond to clicks, manage state with useState), the client-side JavaScript bundle for React must load and "hydrate" the server-rendered HTML. This process re-attaches event listeners and makes the component tree interactive. It's a performance bottleneck for many SSR applications.

React Server Components (RSC): A New Architecture, Not Just Rendering

React Server Components (RSC) are a fundamentally different beast. They aren't just about how the initial HTML is delivered; they redefine where your components execute and how data flows. The core idea is to let components run only on the server, never hydrating on the client. This means zero client-side JavaScript for these components.

RSCs enable you to move heavy data fetching, complex business logic, and even sensitive operations entirely to the server. Imagine a product listing page. With RSCs, the component that fetches product data and renders the list can run entirely on the server. The client receives a highly optimized "RSC Payload" (sometimes called the Flight protocol) that describes the server-rendered tree and its data. You can read more about this payload in our deep dive, React Server Components Explained: Inside the RSC Flight Wire Protocol.

The client then only downloads and renders the interactive parts of your application, which are marked as "Client Components" using the 'use client' directive. This separation has profound implications:

  1. Zero Bundle Size for Server Logic: Any code in a Server Component, including its dependencies, never ships to the client. This dramatically reduces the JavaScript bundle size your users download.
  2. Data Fetching Efficiency: Server Components can fetch data directly from your database or internal APIs without exposing credentials to the client. They can also fetch data in parallel on the server, eliminating client-side "waterfalls" where one fetch depends on the result of another. This is often faster because server-to-server communication is quicker than client-to-server-to-database.
  3. Automatic Memoization: The React.cache() API, often used implicitly by frameworks like Next.js, automatically memoizes data fetches within a single request. This means if multiple Server Components on the same page request the same data, the fetch only happens once. You can learn more about this powerful feature in the React cache() Request Memoization Reference (react.dev).
  4. No Hydration Cost: Server Components never hydrate. Their output is seamlessly integrated into the client-side React tree without the client having to re-render or re-attach anything. This means faster Time to Interactive.

This architectural shift means you're not just getting HTML from the server; you're getting React components that execute in a server environment. This allows for truly full-stack React applications where your data layer and UI layer are tightly integrated on the server. Frameworks like Next.js with its App Router (see Next.js App Router Server Components Documentation) and even minimal frameworks like Waku Minimal React RSC Framework are leveraging this.

app/products/page.tsx
// This is a Server Component by default in the Next.js App Router.
// No 'use client' directive means it runs only on the server.

import ProductCard from '@/components/ProductCard'; // This could be a Client Component or Server Component

interface Product {
  id: string;
  name: string;
  price: number;
}

// Function to fetch products, runs entirely on the server
async function getProducts(): Promise<Product[]> {
  // This fetch call happens on the server, close to your data source.
  // It could be a direct database query or an internal API call.
  const response = await fetch('http://localhost:3000/api/products', { cache: 'no-store' }); // Example, adjust as needed
  if (!response.ok) {
    throw new Error('Failed to fetch products');
  }
  const products = await response.json();
  return products;
}

export default async function ProductsPageRSC() {
  // Data fetching happens during the server render of this component.
  // The client never sees this fetch call or its logic.
  const products = await getProducts(); 

  return (
    <div>
      <h1>Our Products (RSC)</h1>
      <p>This page fetched its data directly on the server, reducing client bundle size.</p>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))', gap: '16px' }}>
        {products.map((product) => (
          // ProductCard could be a Client Component if it needs interactivity (e.g., Add to Cart button)
          // or another Server Component if it's purely display.
          <ProductCard key={product.id} product={product} /> 
        ))}
      </div>
    </div>
  );
  // The output sent to the client is a lightweight RSC payload, not full HTML.
}

// src/components/ProductCard.tsx (example of a Client Component used within a Server Component)
// 'use client';
// export default function ProductCard({ product }: { product: Product }) {
//   const [quantity, setQuantity] = useState(0);
//   return (
//     <div>
//       <h3>{product.name}</h3>
//       <p>${product.price.toFixed(2)}</p>
//       <button onClick={() => setQuantity(q => q + 1)}>Add to Cart ({quantity})</button>
//     </div>
//   );
// }

In the RSC example, ProductsPageRSC is a Server Component. The getProducts() function runs only on the server. The await keyword pauses rendering until the data is ready, but this pause happens on the server, not blocking the client's initial render. The client receives a minimal JavaScript bundle and the RSC payload, which describes the rendered product list. If ProductCard were a Client Component, its interactivity (like an "Add to Cart" button) would hydrate on the client, but the data itself for the card would have already been rendered by the server.

The biggest trade-off with RSCs is the new mental model. You need to consciously decide which components are server and which are client. This impacts how you manage state and context. For example, traditional client-side state management libraries like Zustand Minimal State Management Docs still work for Client Components, but Server Components cannot directly use client-side hooks or context. This requires a shift in how you think about shared state and data flow. This architectural decision will be a cornerstone of the Full-Stack Next.js 2026 Engineering Roadmap.

Side-by-Side: CSR, Traditional SSR, and React Server Components

To clarify the distinct problems these approaches solve, let's look at a direct comparison:

| Feature | Client-Side Rendering (CSR) | Traditional Server-Side Rendering (SSR) | React Server Components (RSC)
| Server Execution? | No (only Client Components) | Yes (for initial HTML) | Yes (for Server Components)

Interactive Engineering Lab: Try It Yourself

Experiment directly with the live interactive React asset below to see the architecture concepts from this guide update in real time—no external sandbox required.

Interactive Asset: RSC vs. SSR vs. SPA Paint & Hydration Timeline
Classic SPA (Client Fetch)JS Bundle: 310 KB • FCP: 864ms • Interactive: 1656ms
Traditional SSR (Hydrate All)JS Bundle: 265 KB • FCP: 414ms • Interactive: 1224ms
RSC + Streaming SSRJS Bundle: 48 KB • FCP: 261ms • Interactive: 432ms

2. How Traditional SSR Actually Works (And Hits the Hydration Wall)

Building web applications in React used to mean one of two things: a Single Page Application (SPA) or Server-Side Rendering (SSR). For years, SSR was the go-to solution for better initial load times and SEO. It solved real problems, but it introduced its own set of complexities, most notably the "hydration wall." Understanding this process is crucial before we look at what React Server Components (RSC) aim to change.

The Server's First Job: HTML Generation

When a browser requests a page from a traditional SSR application, like one built with Next.js Pages Router, the journey begins on the server. The server isn't just serving static files. It's actively building the page for that specific request.

Here's a step-by-step breakdown:

  1. Request Received: Your web server (Node.js, Deno, etc.) gets an HTTP request for a specific URL, say /products/fancy-widget.
  2. Data Fetching: Before rendering any React components, the server often needs data. It might query a database, call an internal API, or fetch from a third-party service. This happens before any HTML is generated. For example, getServerSideProps in Next.js Pages Router handles this.
  3. React renderToString: The server then takes all the fetched data and feeds it into your React application. Instead of rendering to the DOM, React's renderToString function converts your entire component tree into a single, static HTML string. This string includes all the content, styling, and structure of your page.
  4. HTML Sent to Browser: This complete HTML string, along with references to your client-side JavaScript bundles (usually via <script> tags at the bottom of the <body>), is sent back to the browser.
  5. Fast First Contentful Paint (FCP): The browser receives this HTML, parses it, and immediately starts painting the content on the screen. The user sees a fully rendered page very quickly. This is a huge win for perceived performance and SEO, as search engine crawlers receive full content immediately.

Consider a simple product page. The server fetches product details from your backend. It then uses renderToString to create the HTML for the product name, description, price, and an "Add to Cart" button. This HTML arrives in the browser, and the user sees the product almost instantly.

pages/products/[id].tsx
// This is a simplified example, inspired by Next.js Pages Router structure.
// In a real app, you'd have more complex data fetching and UI.

import React, { useState, useEffect } from 'react';
import { GetServerSideProps } from 'next';

interface Product {
  id: string;
  name: string;
  price: number;
  description: string;
}

interface ProductPageProps {
  product: Product;
}

// This component will be rendered on the server to generate initial HTML.
// It will also be re-rendered on the client during hydration.
export default function ProductPage({ product }: ProductPageProps) {
  // Client-side state for showing a "Added to Cart!" message
  const [addedToCart, setAddedToCart] = useState(false);

  // Client-side effect for analytics or other browser-only logic
  useEffect(() => {
    // This code only runs in the browser after hydration.
    // console.log(`Product page for ${product.name} loaded on client.`);
    // Example: send a page view event to an analytics service.
  }, [product.name]);

  const handleAddToCart = () => {
    // This function only works after the component is hydrated.
    console.log(`Adding ${product.name} to cart...`);
    setAddedToCart(true);
    setTimeout(() => setAddedToCart(false), 2000); // Clear message after 2 seconds
  };

  return (
    <div className="product-detail">
      <h1>{product.name}</h1>
      <p className="price">${product.price.toFixed(2)}</p>
      <p>{product.description}</p>
      <button onClick={handleAddToCart} disabled={addedToCart}>
        {addedToCart ? 'Added!' : 'Add to Cart'}
      </button>
      {addedToCart && <p className="success-message">Item successfully added to your cart!</p>}
    </div>
  );
}

// This function runs only on the server for each request.
export const getServerSideProps: GetServerSideProps = async (context) => {
  const { id } = context.params as { id: string };

  // Simulate fetching data from a database or API
  const mockProducts: Product[] = [
    { id: '1', name: 'Fancy Widget', price: 29.99, description: 'A very fancy widget for all your needs.' },
    { id: '2', name: 'Super Gadget', price: 99.50, description: 'The ultimate gadget experience.' },
  ];

  const product = mockProducts.find(p => p.id === id);

  if (!product) {
    return {
      notFound: true, // If product not found, return 404 page
    };
  }

  return {
    props: {
      product, // This product data is passed to the ProductPage component
    },
  };
};

In this example, getServerSideProps fetches the product data on the server. The ProductPage component then uses this data to render the initial HTML. The useState and useEffect hooks, along with the handleAddToCart function, are part of the client-side interactivity that won't work immediately.

The "Uncanny Valley": Interactive But Not Really

Once the browser receives and displays the server-generated HTML, the user sees content quickly. This is great for initial engagement. However, there's a crucial period where the page looks ready, but it isn't actually interactive. This is the "uncanny valley" of traditional SSR.

Imagine you see the "Add to Cart" button from our product page example. You click it. Nothing happens. No spinning loader, no "Added!" message, no item count update. The button is just static pixels. This is because the browser has rendered the raw HTML, but it hasn't yet executed any of the JavaScript that makes the page dynamic.

Here's why this happens:

  1. HTML-Only Display: The browser paints the HTML received from the server. This HTML contains the visual representation of your components, including buttons, input fields, and links.
  2. No JavaScript Yet: At this stage, the client-side JavaScript bundle, which contains all your React code, event handlers, and state management logic, is still being downloaded, parsed, and executed. The <script> tags at the bottom of the HTML tell the browser where to get this JavaScript, but it takes time.
  3. Static DOM: The Document Object Model (DOM) created from the server-rendered HTML is just a static snapshot. There are no event listeners attached to the buttons, no React state initialized, and no client-side routing logic active. If you click a link, it might trigger a full page reload, defeating the purpose of a client-side routing library like React Router 7.

This period can last anywhere from a few hundred milliseconds to several seconds, depending on the network speed, device performance, and the size of your JavaScript bundle. For users on slow mobile connections, or those with older devices, this waiting period can be frustrating. It creates a jarring experience where the page looks ready, but feels broken.

Warning

[!WARNING] The "uncanny valley" directly impacts Time to Interactive (TTI). A long TTI can significantly hurt user experience, leading to higher bounce rates and lower engagement, even if First Contentful Paint (FCP) was fast. Users perceive a slow site if they can't interact with it quickly.

Hydration: Double Execution and the Wall

The browser has rendered the static HTML. Now, the client-side JavaScript bundle finally finishes downloading and parsing. This is where "hydration" comes in. Hydration is the process where React on the client-side "wakes up" the static HTML that was sent from the server.

Here's how hydration works:

  1. Client-Side JavaScript Execution: The browser executes the downloaded JavaScript bundle. This includes your entire React application, along with all its dependencies.
  2. React Takes Over: React on the client-side begins to render the entire component tree again. It doesn't throw away the existing HTML. Instead, it tries to "match" the client-rendered output with the server-rendered HTML already in the DOM.
  3. Attaching Event Listeners & State: During this matching process, React attaches all the necessary event listeners (e.g., onClick for buttons, onChange for inputs) to the DOM elements. It also initializes client-side state hooks (like useState and useReducer) and runs useEffect hooks. This is when your "Add to Cart" button finally becomes clickable.
  4. The "Double Execution" Cost: This is a critical point. Your React application code runs twice: once on the server to generate HTML, and then again on the client to hydrate that HTML. This duplicate work consumes CPU cycles on both the server and the client. For complex applications with large component trees, this can be a significant performance overhead.

The period between the fast FCP and the completion of hydration is the "hydration wall." Users are stuck waiting for the page to become interactive. If your JavaScript bundle is large (e.g., several megabytes), or if the client device is slow, this wall can feel insurmountable.

A common issue during hydration is a "checksum mismatch" error. This occurs when the HTML generated by React on the client-side doesn't exactly match the HTML that was initially sent from the server. This can happen due to:

  • Using browser-specific APIs (like window or localStorage) during server rendering.
  • Conditional rendering based on client-only state or environment variables.
  • Incorrectly handling server-side data that differs from client-side expectations.

These mismatches can cause React to discard the server-rendered HTML and re-render everything from scratch on the client, further delaying interactivity and wasting the initial server-side effort. This is why careful management of client-side boundaries and components that rely on browser APIs is crucial in SSR. We've explored some common pitfalls in managing these boundaries in our guide on The "use client" Boundary Trap: 7 React Server Component Mistakes That Bloat Your Bundle.

Trade-offs of Classic SSR

Traditional SSR, while a significant improvement over pure SPAs for initial load, comes with a distinct set of trade-offs:

FeaturePure Client-Side React (SPA)Traditional SSR (e.g., Next.js Pages Router)
First LoadBlank screen, then content appears after JS download.Fast First Contentful Paint (FCP) with full HTML.
SEODifficult for crawlers without pre-rendering or dynamic rendering.Excellent, crawlers see full HTML content immediately.
Time to Interactive (TTI)Depends on JS bundle size, but usually tied to FCP.Delayed due to hydration wall (JS download + re-execution + attaching events).
JavaScript Bundle SizeCan be very large, all app logic must be in browser.Still potentially very large, as client needs all interactive code.
Server LoadMinimal, serves static files.Significant, requires CPU to render HTML for every request.
Developer ExperienceSimpler client-side logic, but need to handle loading states.More complex, managing server/client environment differences.
Data FetchingClient fetches data after JS loads.Server fetches data before rendering, then client might refetch or hydrate.

Classic SSR provides a great initial experience, but the hydration wall remains a bottleneck for interactivity. The double execution of component logic on both server and client adds overhead. Furthermore, the server needs to be powerful enough to handle rendering for every request, which can impact scalability and cost. This is especially true for highly dynamic pages or applications with many users, requiring robust caching strategies as described in the Next.js App Router Caching Architecture Docs to mitigate server load.

The core problem is that all your React components, even static ones, are bundled and sent to the client, and then re-executed for hydration. This is where React Server Components offer a fundamentally different approach, aiming to eliminate much of this client-side overhead and the hydration wall entirely for specific parts of your application.

Side-by-side comparison diagram of Traditional SSR full-tree hydration versus React Server Components combined with Streaming SSR
Side-by-side comparison diagram of Traditional SSR full-tree hydration versus React Server Components combined with Streaming SSR

3. How React Server Components Change the Rules

React Server Components (RSCs) fundamentally shift where certain parts of your application code execute. Before RSCs, almost all React component logic ran in the browser. Server-Side Rendering (SSR) would generate initial HTML on the server, but the same component JavaScript still shipped to the client for hydration. RSCs break this pattern entirely.

The core idea is simple: some components run only on the server. Their JavaScript code never leaves the server environment. The browser receives only the rendered output, typically HTML, or a special serialized payload that the React client runtime understands. This single change has massive implications for performance, security, and developer experience.

Server-Only Execution: The Zero Client Bundle Advantage

The biggest immediate benefit of Server Components is their impact on client-side bundle size. When a component is marked as a Server Component, its entire JavaScript logic stays on the server. This includes any imported libraries, data fetching code, or utility functions it uses. The client bundle gets smaller, sometimes dramatically.

Consider a component that renders a complex data table, pulling in a charting library, a date formatting utility, and a data transformation helper. If this was a client component, all that JavaScript would ship to the browser. With a Server Component, only the final HTML table makes the trip. The browser doesn't need to download, parse, or execute any of the component's underlying JavaScript. This leads to faster page loads and a quicker Time To Interactive (TTI), especially on slower networks or less powerful devices.

Here's a mental model: think of a Server Component as a mini-API endpoint that returns UI. You call it (by importing it into another component or a page), it runs on the server, fetches data, processes it, and then sends its rendered HTML or instructions back. The browser doesn't need to know how that UI was generated, only what to display.

Engineering Tip

[!TIP] To truly maximize the zero client bundle advantage, be mindful of what you import into Server Components. If you import a client component, only the client component's code will be included in the client bundle. If you import a large utility library that's only used by a Server Component, that library's code stays on the server.

Direct Server-Side Access: Database and Filesystem

One of the most powerful aspects of Server Components is their ability to directly access server-side resources. In traditional client-side React, if you needed data from a database, you'd make an API call to a separate backend server. This involves an extra network hop, increased latency, and the need to build and maintain that API layer.

With Server Components, you can await a database query directly inside your component. You can read from the filesystem, interact with internal services, or access environment variables that are strictly server-only. This capability streamlines data fetching significantly. It eliminates the need to build a separate GraphQL or REST API for every piece of data your UI needs.

Let's look at a concrete example. Imagine a product detail page. Before RSCs, your ProductPage client component would fetch('/api/products/:id') in a useEffect hook. That /api/products/:id endpoint would then connect to your database. With Server Components, the database connection happens directly within the ProductPage component itself.

app/products/[id]/page.tsx
import { db } from '@/lib/db'; // Assume '@/lib/db' exports a database client
import { notFound } from 'next/navigation'; // For Next.js specific notFound helper
import { ProductReviewList } from '@/components/ProductReviewList'; // A Client Component

// This entire file is a Server Component by default in Next.js App Router
export default async function ProductPage({ params }: { params: { id: string } }) {
  const productId = params.id;

  // Direct database query executed on the server
  // No separate API endpoint needed, no client-side fetch
  const product = await db.product.findUnique({
    where: { id: productId },
    include: {
      category: true,
      reviews: {
        select: {
          id: true,
          rating: true,
          comment: true,
          user: { select: { name: true } }
        }
      }
    }
  });

  if (!product) {
    notFound(); // Handle missing product gracefully
  }

  // Calculate average rating directly on the server
  const averageRating = product.reviews.length > 0
    ? product.reviews.reduce((sum, review) => sum + review.rating, 0) / product.reviews.length
    : 0;

  return (
    <div className="container mx-auto p-6">
      <h1 className="text-3xl font-bold mb-4">{product.name}</h1>
      <p className="text-lg text-gray-700 mb-2">${product.price.toFixed(2)}</p>
      <p className="text-md text-gray-600 mb-4">Category: {product.category.name}</p>
      <div className="flex items-center mb-6">
        <span className="text-xl font-semibold mr-2">{averageRating.toFixed(1)}</span>
        <span className="text-yellow-500">{'★'.repeat(Math.round(averageRating))}</span>
        <span className="text-gray-400">{'★'.repeat(5 - Math.round(averageRating))}</span>
        <span className="ml-2 text-sm text-gray-500">({product.reviews.length} reviews)</span>
      </div>

      <p className="text-gray-800 leading-relaxed mb-8">{product.description}</p>

      {/* ProductReviewList is a Client Component, passed server-fetched data */}
      <ProductReviewList reviews={product.reviews} productId={product.id} />
    </div>
  );
}

In this example, the ProductPage component directly queries the db object. The db client is a server-side module, and its credentials never leave the server. This is a significant security improvement. Database connection strings, API keys for internal services, or sensitive environment variables (like those often accessed via process.env.DB_CONNECTION_STRING or import.meta.env.VITE_SECRET_KEY in Vite-based projects, though client components only access VITE_ prefixed public ones) remain secure on the backend. This directly addresses several risks outlined in the OWASP Top 10 Web Application Security Risks, particularly those related to sensitive data exposure.

This direct access also improves performance by eliminating network waterfalls. Instead of chained client-server-database requests, the component directly makes the database call. For more on optimizing these server-side data fetches, refer to our guide on Eliminating Request Waterfalls in React Server Components with Parallel Streaming & Suspense. The server environment can also leverage powerful caching mechanisms that are not available to the client.

No Hydration for Server Components

One of the most crucial distinctions between Server Components and traditional Server-Side Rendering (SSR) is how they interact with the client-side React runtime. When you use SSR with a client-side React application, the server generates HTML, and then the client-side JavaScript "hydrates" that HTML. Hydration is the process where React attaches event listeners and re-renders the component tree on the client, essentially taking over the static HTML to make it interactive. This hydration step can be costly, as it involves downloading, parsing, and executing a significant amount of JavaScript.

Server Components never hydrate. Their output is either plain HTML or a special serialized data format that the React client runtime uses to efficiently update the DOM. This means the browser doesn't need to re-run the Server Component's logic, re-create its virtual DOM, or attach event handlers. The Server Component's job is done once its output is sent.

This "no hydration" principle is a key enabler for the zero client bundle advantage. If Server Components needed to hydrate, their JavaScript would still have to be sent to the client. By skipping hydration, they truly remain server-only.

So, how do you get interactivity? This is where Client Components come in. You nest Client Components within your Server Components. Only the Client Components and their direct children hydrate. The Server Component itself provides the static shell and passes down any necessary data as props to its interactive Client Component children.

For example, a ProductPage (Server Component) might fetch product data and then render a AddToCartButton (Client Component) and pass the productId to it. The AddToCartButton then handles its own interactivity, potentially using a "Server Action" to update the cart on the server. Server Actions are special functions marked with 'use server' that allow client components to trigger server-side code without needing a separate API route. You can learn more about them in the React 'use server' Server Functions Guide (react.dev) and the Next.js Server Actions & Mutations Guide. The useActionState hook is also useful for managing state during server action calls, as detailed in the React useActionState Hook Reference (react.dev).

Here's a quick comparison of SSR vs. RSC:

FeatureTraditional SSR (e.g., Next.js Pages Router)React Server Components (e.g., Next.js App Router)
Execution LocationServer (initial render) & Client (hydration + updates)Server (initial render & subsequent updates)
Client JS BundleComponent JS code sent to client for hydrationServer Component JS never sent to client
HydrationYes, always for server-rendered componentsNo, Server Components do not hydrate
Direct Data AccessNo, requires client-side fetch or server-side API routesYes, direct database/filesystem access
Sensitive Logic/KeysMust be proxied via API routes or kept server-sideCan live directly within the component
InteractivityAll managed by client-side JavaScriptProvided by nested Client Components or Server Actions
StreamingContent streams, but full JS bundle still neededContent streams, JS bundle significantly reduced

This fundamental difference in hydration is why Server Components solve a completely different set of problems than traditional SSR. SSR aims to get some content on the screen quickly, but still requires the full client-side application to become interactive. Server Components aim to minimize the client-side application entirely for parts of your UI, pushing that work to the server where it belongs. This leads to a leaner, faster, and more secure user experience.

4. How SSR and RSC Work Together on Every Page Load

Understanding the interplay between Server-Side Rendering (SSR) and React Server Components (RSC) is crucial. They aren't competing technologies; they're complementary. SSR's job is to deliver initial HTML. RSC's job is to define what renders on the server and how data flows.

Think of it this way: RSCs are the blueprints and materials for building components on the server. SSR is the construction crew that takes those blueprints, builds the initial structure, and paints it, ready for the client to move in.

The First Request: A Full HTML Delivery

When a user types your URL into their browser for the first time, or refreshes a page, a "hard navigation" occurs. This kicks off a specific sequence involving both RSC and SSR to deliver a fully rendered, interactive page.

Here’s the step-by-step lifecycle:

  1. Browser Request: The user's browser sends an HTTP GET request to your server for a specific URL, say /products/laptops.
  2. Server Receives Request: Your Next.js (or similar framework) server intercepts this request. It identifies which React Server Components are needed for the /products/laptops route.
  3. RSC Execution (Data Fetching & Rendering):
    • The server starts executing the relevant RSCs. These components run before any client-side JavaScript loads.
    • They fetch data directly from your database, internal APIs, or file system. For example, a ProductList RSC might call db.getProductsByCategory('laptops'). This is where you might integrate with a robust data layer, perhaps one optimized for server-side operations, unlike some client-side patterns you'd find in a traditional PostgreSQL vs. Supabase Architecture Benchmark comparison.
    • As RSCs render, they produce a special React "Flight" payload. This payload isn't HTML. It's a highly optimized, JSON-like data structure that describes the component tree, including props, children, and references to client components.
    • Crucially, if an RSC encounters a Suspense boundary while fetching data, React can start streaming the parts of the page that are ready, rather than waiting for everything. This is a powerful optimization for perceived performance. You can read more about this in the official React Suspense Streaming Reference.
  4. SSR Conversion to HTML:
    • The framework's SSR engine takes the Flight payload generated by the RSCs.
    • It then converts this payload into a static HTML string. This HTML includes the actual rendered content (text, images, client component placeholders), along with a minimal JavaScript bundle that bootstraps React on the client.
    • Any Suspense fallbacks (e.g., a loading spinner) are rendered directly into the HTML if the data isn't ready. When the data does become available, React streams additional HTML chunks to replace those fallbacks.
  5. HTML Streaming & Initial Download:
    • The server sends this generated HTML back to the browser.
    • Because of Suspense, the HTML can be streamed progressively. The browser starts rendering the head, then the body, showing content as it arrives. This improves perceived loading speed, especially for users on slower networks.
  6. Client-Side Hydration:
    • Once the browser receives and parses the HTML, it starts downloading the client-side JavaScript bundles.
    • React on the client "hydrates" the static HTML. This means it attaches event listeners, mounts client components, and makes the page interactive. Hydration is selective; only client components and their descendants are hydrated. Server components are never hydrated on the client.

This entire process ensures the user sees meaningful content very quickly, leading to a better user experience and improved metrics like Largest Contentful Paint (LCP), which is critical for search engine rankings. You can learn more about optimizing LCP on web.dev's LCP Guide.

Here’s a simplified example of a server component that fetches data, which then gets rendered into the initial HTML:

app/products/page.tsx
// This component runs entirely on the server. It's an RSC.
import { ProductCard } from '@/components/ProductCard'; // This could be a Client Component

interface Product {
  id: string;
  name: string;
  price: number;
  imageUrl: string;
}

// Simulate a database fetch. In a real app, this would be an ORM call or API fetch.
async function getProducts(): Promise<Product[]> {
  // Imagine a 1-second delay for a database query
  await new Promise(resolve => setTimeout(resolve, 1000));
  return [
    { id: '1', name: 'FutureStack Laptop Pro', price: 1899, imageUrl: '/laptop-pro.jpg' },
    { id: '2', name: 'FutureStack Monitor X', price: 799, imageUrl: '/monitor-x.jpg' },
    { id: '3', name: 'FutureStack Keyboard Elite', price: 149, imageUrl: '/keyboard-elite.jpg' },
  ];
}

export default async function ProductsPage() {
  const products = await getProducts(); // Data fetching directly on the server. No client-side bundle for this.

  return (
    <div className="container mx-auto p-4">
      <h1 className="text-3xl font-bold mb-6">Our Latest Products</h1>
      <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
        {products.map(product => (
          // ProductCard could be a Client Component, but its props are passed from the Server Component.
          <ProductCard key={product.id} product={product} /> 
        ))}
      </div>
    </div>
  );
}

In this flow, the ProductsPage RSC fetches data on the server. The entire HTML for "Our Latest Products" and the ProductCard components (with their data) is generated on the server and sent as part of the initial HTML. The client only needs to hydrate the ProductCard if it contains interactive elements (e.g., an "Add to Cart" button).

Subsequent Navigations: The RSC Flight Payload Advantage

The magic of RSC truly shines during "soft navigations." This happens when a user clicks an internal link (e.g., a <Link> component in Next.js) after the initial page load. Instead of requesting a whole new HTML document, the client-side router takes over.

Here's the lifecycle for a soft navigation:

  1. Client-Side Navigation: The user clicks a <Link href="/products/desktops">Desktops</Link> on your already interactive page.
  2. Client Router Intercepts: The client-side router (e.g., Next.js App Router) intercepts this click. It prevents a full page reload.
  3. RSC Flight Payload Request: The client-side router makes a specialized fetch request to the server. This request explicitly asks for the RSC Flight payload for the new route, not a full HTML document.
    • The request typically includes a RSC header or similar mechanism to signal it's an RSC-specific fetch.
    • It also sends information about the current client-side state, allowing React to optimize the payload.
  4. Server Executes RSCs (Again):
    • The server receives this request. It executes the relevant RSCs for /products/desktops, just like in the initial load.
    • It fetches data, renders components, and generates a new RSC Flight payload.
    • Crucially, the server might only send diffs of the component tree if parts of the page haven't changed. This makes the payload much smaller.
  5. Flight Payload Streaming: The server streams this new Flight payload back to the client. This payload contains instructions on how to update the current UI.
  6. Client React Patches DOM:
    • The client-side React runtime receives the Flight payload.
    • It intelligently compares the new component tree described in the payload with the current component tree in memory.
    • React then patches the existing DOM directly. It surgically updates only the parts of the UI that have changed, adds new elements, or removes old ones.
    • There is no full HTML rebuild on the client. There is no re-hydration of unchanged parts of the page. Only new client components (or existing ones with new props) are hydrated.

This process is incredibly efficient. It minimizes network payload size and client-side JavaScript execution, leading to near-instantaneous page transitions. It feels like a Single Page Application (SPA), but with all the benefits of server rendering and data fetching.

Engineering Tip

[!TIP] To maximize the benefits of RSC during soft navigations, ensure your data fetching logic is efficient. Use React's cache function or Next.js's 'use cache' directive for memoizing server-side data fetches. This prevents redundant database queries on subsequent requests for the same data, even across different RSCs. You can find more details in the Next.js 'use cache' Directive Reference.

Consider a scenario where you have a filter for product categories.

app/products/[[...category]]/page.tsx
// This is a Server Component. It can dynamically adapt based on URL params.
import { ProductCard } from '@/components/ProductCard'; // Client Component
import { CategoryFilter } from '@/components/CategoryFilter'; // Client Component with navigation logic

interface Product {
  id: string;
  name: string;
  price: number;
  imageUrl: string;
}

// Simulate a database fetch based on category
async function getProductsByCategory(category: string | undefined): Promise<Product[]> {
  await new Promise(resolve => setTimeout(resolve, 500)); // Simulate network delay
  if (category === 'desktops') {
    return [
      { id: '4', name: 'FutureStack Desktop Pro', price: 2199, imageUrl: '/desktop-pro.jpg' },
      { id: '5', name: 'FutureStack Mini PC', price: 899, imageUrl: '/mini-pc.jpg' },
    ];
  }
  // Default to laptops if no category or unknown category
  return [
    { id: '1', name: 'FutureStack Laptop Pro', price: 1899, imageUrl: '/laptop-pro.jpg' },
    { id: '2', name: 'FutureStack Monitor X', price: 799, imageUrl: '/monitor-x.jpg' },
  ];
}

export default async function ProductsCategoryPage({ 
  params,
}: { 
  params: { category?: string[] } 
}) {
  const selectedCategory = params.category?.[0]; // e.g., 'laptops' or 'desktops'
  const products = await getProductsByCategory(selectedCategory); // Server-side data fetch

  return (
    <div className="container mx-auto p-4">
      <h1 className="text-3xl font-bold mb-6">
        {selectedCategory ? `Products in ${selectedCategory}` : 'All Products'}
      </h1>
      <CategoryFilter currentCategory={selectedCategory} /> {/* Client Component for navigation */}
      <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mt-6">
        {products.map(product => (
          <ProductCard key={product.id} product={product} />
        ))}
      </div>
    </div>
  );
}

// components/CategoryFilter.tsx (Client Component)
'use client';

import Link from 'next/link'; // next/link is a client component

export function CategoryFilter({ currentCategory }: { currentCategory?: string }) {
  return (
    <nav className="flex space-x-4 mb-4">
      <Link 
        href="/products" 
        className={`px-4 py-2 rounded-lg ${!currentCategory ? 'bg-blue-600 text-white' : 'bg-gray-200'}`}
      >
        All
      </Link>
      <Link 
        href="/products/laptops" 
        className={`px-4 py-2 rounded-lg ${currentCategory === 'laptops' ? 'bg-blue-600 text-white' : 'bg-gray-200'}`}
      >
        Laptops
      </Link>
      <Link 
        href="/products/desktops" 
        className={`px-4 py-2 rounded-lg ${currentCategory === 'desktops' ? 'bg-blue-600 text-white' : 'bg-gray-200'}`}
      >
        Desktops
      </Link>
    </nav>
  );
}

When a user clicks "Desktops" from the "Laptops" page, the CategoryFilter (a client component) uses next/link to trigger a soft navigation. The server re-runs ProductsCategoryPage with category='desktops', fetches new data, and sends a Flight payload. The client-side React then efficiently updates only the product list, leaving the header and filter UI largely untouched.

Comparing the Lifecycle: HTML vs. Flight Stream

Let's put the two navigation types side-by-side to highlight their differences.

FeatureInitial (Hard) Navigation (Load #1)Soft Navigation (Load #2+)
TriggerDirect URL entry, page refresh, external link clickInternal <Link> click, router.push()
Server OutputFull HTML document (SSR converts RSC output)RSC Flight payload (JSON-like instructions)
Network PayloadLarge HTML string + CSS + JS bundlesSmaller Flight payload + any new JS bundles for new client components
Client-Side WorkParse HTML, download JS, hydrate full page (selective)Receive Flight payload, React diffs & patches DOM
HydrationFull (selective) hydration of client components on initial HTMLOnly new or updated client components are hydrated
Perceived SpeedFast Time-To-First-Byte (TTFB), good LCPInstantaneous transitions, feels like an SPA
SEO ImpactExcellent, search engines crawl rendered HTMLIndirectly good via fast UX, but initial HTML is key for first crawl
Server Re-renderFull server re-render of RSC treeFull server re-render of RSC tree (optimized via cache)

This comparison makes it clear: SSR is about getting that first meaningful paint quickly and reliably, crucial for SEO and initial user experience. RSC, especially with Flight payloads, is about making subsequent interactions incredibly fast and efficient, minimizing client-side work and network traffic. They are two distinct mechanisms working in concert for a superior web experience.

Real-World Implications and Optimizations

The combined power of SSR and RSC significantly impacts performance and development.

Performance Metrics: The initial HTML delivery from SSR, powered by RSCs, directly improves metrics like First Contentful Paint (FCP) and Largest Contentful Paint (LCP). For soft navigations, the Flight payload minimizes Total Blocking Time (TBT) and Interaction to Next Paint (INP) because less JavaScript needs to run to update the UI.

Security: When fetching data directly on the server within RSCs, you have direct access to sensitive server-side resources like database credentials or API keys. It's crucial to prevent this data from accidentally leaking to the client. React provides security mechanisms like experimental_taintObjectReference which can help ensure that sensitive objects are never passed to the client. You can read more about this on the official React experimental_taintObjectReference Security API documentation.

Caching Strategies: Effective caching is paramount. For server-side data fetches, utilize React's built-in cache function or framework-specific caching directives (like Next.js's 'use cache'). This ensures that if multiple RSCs on the same request, or even different requests within a short time frame, ask for the same data, it's only fetched once from the database. This is a powerful optimization that can drastically reduce database load.

SEO & AIEO: The initial SSR-generated HTML is a complete, crawlable document, which is ideal for traditional SEO. For AI Engine Optimization, the speed and interactivity provided by RSCs contribute to a high-quality user experience, which AI models increasingly factor into content ranking. Additionally, having a fast, interactive site can help AI crawlers fully render and understand your content. For advanced schema generation to boost both SEO and AIEO, consider using a tool like the Free SEO & AIEO Schema Generator.

By understanding these distinct lifecycles and leveraging the strengths of both SSR and RSC, developers can build applications that are fast, secure, and highly performant from the very first load to every subsequent interaction.

5. Code Comparison: Same Dashboard Built with Classic SSR vs. RSC

Building a simple product dashboard is a common task. You need to fetch data, display it, and let users filter or sort it. This seemingly straightforward problem reveals the fundamental differences between classic Server-Side Rendering (SSR) and React Server Components (RSC). We'll build the same dashboard twice to show these differences.

Our example dashboard will display a list of products. Each product has an ID, name, description, and price. Users should be able to search for products by name.

Classic SSR: The getServerSideProps Approach

Before the App Router and React Server Components, Next.js applications often relied on getServerSideProps (or getStaticProps) for server-side data fetching. This function runs exclusively on the server during a request. It fetches data and passes it as props to a React component, which then renders on the server. The resulting HTML is sent to the browser.

Once in the browser, React "hydrates" the HTML. This means React takes over, attaching event listeners and making the page interactive. For any subsequent data fetching or filtering, the client-side React component typically takes charge. This often involves useState to manage filter states and useEffect to re-fetch or re-filter data.

Consider a scenario where our product data isn't huge, say 100 products. With classic SSR, you'd fetch all 100 products on the server. Then, you'd send all that product data to the client. If the user types in a search box, the client-side JavaScript filters this already-present data. This sounds efficient for small datasets, but it has hidden costs.

Here’s how a product dashboard might look using getServerSideProps in the Next.js Pages Router:

pages/products.tsx
import { useState, useEffect, useMemo } from 'react';
import type { GetServerSideProps, NextPage } from 'next';

// Define a simple Product type for clarity
interface Product {
  id: string;
  name: string;
  description: string;
  price: number;
}

// Simulate a database call that returns all products
async function fetchAllProductsFromDB(): Promise<Product[]> {
  // In a real app, this would be a database query or an internal API call.
  // We're simulating a small delay to mimic network/DB latency.
  await new Promise(resolve => setTimeout(resolve, 150));
  return [
    { id: 'p1', name: 'Wireless Mouse', description: 'Ergonomic design, long battery life.', price: 29.99 },
    { id: 'p2', name: 'Mechanical Keyboard', description: 'RGB backlit, clicky switches.', price: 99.99 },
    { id: 'p3', name: 'USB-C Hub', description: '7-in-1 adapter for laptops.', price: 49.99 },
    { id: 'p4', name: 'Monitor Stand', description: 'Raises monitor for better posture.', price: 19.99 },
    { id: 'p5', name: 'Webcam 1080p', description: 'Full HD video calls, auto-focus.', price: 79.99 },
    { id: 'p6', name: 'Noise-Cancelling Headphones', description: 'Immersive audio experience.', price: 149.99 },
    { id: 'p7', name: 'Portable SSD 1TB', description: 'Fast external storage.', price: 129.99 },
    { id: 'p8', name: 'Gaming Chair', description: 'Adjustable lumbar support.', price: 299.99 },
  ];
}

// This function runs on the server for each request
export const getServerSideProps: GetServerSideProps = async (context) => {
  console.log('Fetching products via getServerSideProps...'); // Server-side log
  const products = await fetchAllProductsFromDB();
  return {
    props: {
      products, // All products are passed to the client
      timestamp: new Date().toISOString(), // Just to show server-side context
    },
  };
};

// This is a Client Component, even though it's rendered initially on the server
const ProductsPage: NextPage<{ products: Product[]; timestamp: string }> = ({ products, timestamp }) => {
  const [searchTerm, setSearchTerm] = useState(''); // Client-side state for search input
  const [filteredProducts, setFilteredProducts] = useState<Product[]>(products); // Client-side state for filtered list

  // Format price on the client. If we had more complex formatting (e.g., date, currency based on locale),
  // these would also add to the client-side JavaScript bundle.
  const formatPrice = (price: number) => `$${price.toFixed(2)}`;

  useEffect(() => {
    // Client-side filtering logic
    const results = products.filter(product =>
      product.name.toLowerCase().includes(searchTerm.toLowerCase())
    );
    setFilteredProducts(results);
  }, [searchTerm, products]); // Re-run effect when search term or initial products change

  return (
    <div style={{ maxWidth: '800px', margin: '2rem auto', padding: '1rem', fontFamily: 'sans-serif' }}>
      <h1>Product Dashboard (Classic SSR)</h1>
      <p>Data fetched on server at: {timestamp}</p> {/* Shows server-side data */}

      <div style={{ marginBottom: '1.5rem' }}>
        <input
          type="text"
          placeholder="Search products..."
          value={searchTerm}
          onChange={(e) => setSearchTerm(e.target.value)} // Updates client-side state
          style={{ padding: '0.6rem', width: '100%', borderRadius: '4px', border: '1px solid #ccc' }}
        />
      </div>

      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))', gap: '1.5rem' }}>
        {filteredProducts.length === 0 ? (
          <p>No products found matching your search.</p>
        ) : (
          filteredProducts.map((product) => (
            <div key={product.id} style={{ border: '1px solid #eee', borderRadius: '8px', padding: '1rem', boxShadow: '0 2px 4px rgba(0,0,0,0.05)' }}>
              <h2 style={{ fontSize: '1.25rem', margin: '0 0 0.5rem' }}>{product.name}</h2>
              <p style={{ color: '#555', fontSize: '0.9rem', marginBottom: '0.75rem' }}>{product.description}</p>
              <p style={{ fontWeight: 'bold', fontSize: '1.1rem' }}>{formatPrice(product.price)}</p> {/* Client-side formatting */}
            </div>
          ))
        )}
      </div>
    </div>
  );
};

export default ProductsPage;

In this classic SSR setup:

  1. getServerSideProps runs on the server, fetches all products from our simulated database, and passes them to ProductsPage.
  2. The ProductsPage component receives the complete products array.
  3. The initial render (both server and client) displays all products.
  4. When a user types in the search box, setSearchTerm updates client-side state.
  5. A useEffect hook then filters the entire products array (which is already on the client) based on the searchTerm. This triggers a re-render of the product list, all happening in the browser.
  6. The formatPrice function also runs entirely on the client. If this function were complex (e.g., handling multiple currencies, localization, or complex date formats), its code would be part of the client-side JavaScript bundle.

The key takeaway here is the "fat client" approach. The client receives all the raw data and then handles all filtering, sorting, and presentation logic itself. This can lead to larger initial JavaScript bundles and more work for the client's CPU, especially with large datasets or complex client-side transformations.

Warning

[!WARNING] While client-side filtering can feel fast for small, static datasets, it comes with significant downsides. For large datasets, transferring all data to the client is slow and wasteful. It also exposes all raw data to the user's browser, which can be a security risk if sensitive information is present, even if not displayed. Imagine a dashboard with internal user data – you wouldn't want to ship all of that to every client.

Modern RSC: The Async Server Component Approach

React Server Components fundamentally change where data fetching and rendering happen. An async Server Component can directly fetch data (e.g., from a database or an internal API) and render parts of your UI on the server. Only the result of that rendering (a special JSON format called the React Flight protocol) is streamed to the client. This protocol is what we explain in detail in React Server Components Explained: Inside the RSC Flight Wire Protocol.

With RSC, when a user types in a search box, you don't necessarily filter data on the client. Instead, the search term is often sent back to the server (e.g., via URL search parameters or a Server Action). The Server Component then re-fetches only the filtered data and re-renders that specific part of the UI on the server. The client receives only the updated UI, not the entire dataset. This is a "thin client" model.

Here’s how the same product dashboard would look using RSC in the Next.js App Router:

app/products/page.tsx
import { Suspense } from 'react';
import ProductFilter from './components/ProductFilter'; // This will be a Client Component
import ProductList from './components/ProductList'; // This will be a Server Component for data display

// Define a simple Product type
interface Product {
  id: string;
  name: string;
  description: string;
  price: number;
}

// Simulate a database call that fetches *filtered* products
// This function runs exclusively on the server.
async function fetchFilteredProductsFromDB(searchTerm: string): Promise<Product[]> {
  // In a real app, this would be a database query with a WHERE clause.
  await new Promise(resolve => setTimeout(resolve, 250)); // Simulate DB latency
  const allProducts = [
    { id: 'p1', name: 'Wireless Mouse', description: 'Ergonomic design, long battery life.', price: 29.99 },
    { id: 'p2', name: 'Mechanical Keyboard', description: 'RGB backlit, clicky switches.', price: 99.99 },
    { id: 'p3', name: 'USB-C Hub', description: '7-in-1 adapter for laptops.', price: 49.99 },
    { id: 'p4', name: 'Monitor Stand', description: 'Raises monitor for better posture.', price: 19.99 },
    { id: 'p5', name: 'Webcam 1080p', description: 'Full HD video calls, auto-focus.', price: 79.99 },
    { id: 'p6', name: 'Noise-Cancelling Headphones', description: 'Immersive audio experience.', price: 149.99 },
    { id: 'p7', name: 'Portable SSD 1TB', description: 'Fast external storage.', price: 129.99 },
    { id: 'p8', name: 'Gaming Chair', description: 'Adjustable lumbar support.', price: 299.99 },
  ];
  console.log(`Server: Fetching products for search term: "${searchTerm}"`); // Server-side log
  return allProducts.filter(product =>
    product.name.toLowerCase().includes(searchTerm.toLowerCase())
  );
}

// This is the main Server Component for the products page.
// It's an async component, meaning it can directly await data fetching.
export default async function ProductsPage({
  searchParams, // Next.js automatically provides searchParams to Server Components
}: {
  searchParams: { [key: string]: string | string[] | undefined };
}) {
  const searchTerm = typeof searchParams.q === 'string' ? searchParams.q : '';

  // Data fetching happens directly here, on the server, before rendering.
  const products = await fetchFilteredProductsFromDB(searchTerm);

  // Server-side formatting for price.
  // This logic stays on the server and doesn't ship to the client.
  const formatPrice = (price: number) => `$${price.toFixed(2)}`;

  return (
    <div style={{ maxWidth: '800px', margin: '2rem auto', padding: '1rem', fontFamily: 'sans-serif' }}>
      <h1>Product Dashboard (RSC)</h1>
      <p>Data fetched on server for current view.</p>

      {/* ProductFilter is a Client Component that interacts with URL search params */}
      <ProductFilter initialSearchTerm={searchTerm} />

      {/* ProductList is a Server Component that receives already-filtered, formatted data */}
      <Suspense fallback={<p>Loading products...</p>}>
        <ProductList products={products} formatPrice={formatPrice} />
      </Suspense>
    </div>
  );
}

And here are the two supporting components:

app/products/components/ProductFilter.tsx
'use client'; // This directive marks this component as a Client Component

import { useState, useEffect } from 'react';
import { useRouter, useSearchParams } from 'next/navigation';
import { useDebounce } from 'use-debounce'; // A common utility for debouncing input

export default function ProductFilter({ initialSearchTerm }: { initialSearchTerm: string }) {
  const router = useRouter();
  const searchParams = useSearchParams();
  const [inputValue, setInputValue] = useState(initialSearchTerm);
  const [debouncedInputValue] = useDebounce(inputValue, 500); // Debounce search input

  useEffect(() => {
    // Only update URL if debounced input value changes and is different from current URL param
    if (debouncedInputValue !== searchParams.get('q')) {
      const current = new URLSearchParams(Array.from(searchParams.entries()));
      if (debouncedInputValue) {
        current.set('q', debouncedInputValue);
      } else {
        current.delete('q');
      }
      // This push will trigger a *new server request* for the RSC page.
      router.push(`?${current.toString()}`);
    }
  }, [debouncedInputValue, router, searchParams]);

  return (
    <div style={{ marginBottom: '1.5rem' }}>
      <input
        type="text"
        placeholder="Search products..."
        value={inputValue}
        onChange={(e) => setInputValue(e.target.value)}
        style={{ padding: '0.6rem', width: '100%', borderRadius: '4px', border: '1px solid #ccc' }}
      />
    </div>
  );
}
app/products/components/ProductList.tsx
// This component can be a Server Component or a Client Component.
// If it's a Server Component, it means it receives already-processed data.
// If it were a Client Component, it would need the 'use client' directive.
// For this example, let's keep it as a Server Component to show minimal client JS.

interface Product {
  id: string;
  name: string;
  description: string;
  price: number;
}

// The formatPrice function is passed down from the parent Server Component.
// This means the formatting logic is never shipped to the client.
export default function ProductList({ products, formatPrice }: { products: Product[]; formatPrice: (price: number) => string }) {
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))', gap: '1.5rem' }}>
      {products.length === 0 ? (
        <p>No products found matching your search.</p>
      ) : (
        products.map((product) => (
          <div key={product.id} style={{ border: '1px solid #eee', borderRadius: '8px', padding: '1rem', boxShadow: '0 2px 4px rgba(0,0,0,0.05)' }}>
            <h2 style={{ fontSize: '1.25rem', margin: '0 0 0.5rem' }}>{product.name}</h2>
            <p style={{ color: '#555', fontSize: '0.9rem', marginBottom: '0.75rem' }}>{product.description}</p>
            <p style={{ fontWeight: 'bold', fontSize: '1.1rem' }}>{formatPrice(product.price)}</p> {/* Server-side formatted price */}
          </div>
        ))
      )}
    </div>
  );
}

In this modern RSC setup:

  1. app/products/page.tsx is an async Server Component. It receives searchParams directly from the URL.
  2. fetchFilteredProductsFromDB runs on the server. It uses the searchTerm from the URL to fetch only the relevant products from the database.
  3. The formatPrice function also resides and runs on the server. Its code is never sent to the client.
  4. ProductFilter is a Client Component (marked with 'use client'). It uses useState for the input value and useRouter to update the URL's q search parameter.
  5. When router.push is called, it triggers a new request to the server. The server re-executes app/products/page.tsx with the new searchParams.
  6. The server then sends back only the newly rendered UI for the updated product list, not the entire page, and certainly not the full dataset.
  7. ProductList can remain a Server Component, receiving already-filtered and formatted data. It has zero client-side JavaScript.

This approach means the client receives a much smaller initial payload. For subsequent interactions (like searching), the client only receives the minimal diff of the UI, not raw data or complex formatting logic. This shifts the computational burden and data transfer from the client back to the server, where resources are often more abundant and predictable. This is a core tenet of the Full-Stack Next.js 2026 Engineering Roadmap.

If you needed to perform mutations or more complex interactions (e.g., adding a product to a cart), you could use React 'use server' Server Functions Guide (react.dev) or Next.js Server Actions & Mutations Guide. These allow you to define functions that run exclusively on the server but can be called directly from Client Components, providing a secure and efficient way to interact with backend logic. You could even use useActionState from React useActionState Hook Reference (react.dev) to manage pending states and errors for these server actions.

Key Differences and Trade-offs

The code comparison highlights the fundamental shift in architecture. Let's break down the implications:

FeatureClassic SSR (getServerSideProps)React Server Components (RSC)
Data Fetching LocationServer-side (getServerSideProps), then passed as props.Server-side (directly in async Server Components).
Initial Data PayloadOften includes all data for potential client-side operations.Only fetches and sends relevant data for the current view.
Subsequent InteractionsClient-side useState/useEffect for filtering/sorting.Triggers a new server render (via URL or Server Action) for new data.
Client JavaScript BundleLarger; includes data fetching logic, filtering/sorting logic, and formatting functions if used client-side.Smaller; only interactive Client Components and minimal React runtime. Data logic stays on server.
Data SecurityRaw data potentially exposed to client for client-side filtering.Sensitive data stays on the server; only rendered UI sent.
Performance (Initial Load)Good, as HTML is pre-rendered.Excellent, minimal JS, faster Time-To-Interactive.
Performance (Interactions)Can be fast if data is already on client. Can be slow if client re-fetches.Often faster, as server handles heavy lifting, sends only UI diffs.
Developer ExperienceClear separation of server/client logic, but can lead to "prop drilling" with data.Blurs server/client boundary in a powerful way, enables direct DB access from components.
Mental Model"Fat Client" – client does more work."Thin Client" – server does more work.

The choice between these approaches isn't about one being universally "better." It's about solving different problems.

Classic SSR excels when:

  • You need a fast initial page load with a static or mostly static view.
  • Interactivity is minimal, or subsequent data changes are rare.
  • The entire dataset is small and non-sensitive enough to be shipped to the client.

RSC shines when:

  • You have large or sensitive datasets where you want to minimize client payload and exposure.
  • Complex data transformations, filtering, or sorting logic needs to run on the server to reduce client-side work.
  • You want to leverage server resources (CPU, memory, database access) directly within your component tree.
  • You prioritize a minimal client JavaScript bundle for faster loading and better performance on low-end devices.
  • You want to keep database credentials and API keys strictly on the server, never exposing them to the browser. This aligns with fundamental principles from the OWASP Top 10 Web Application Security Risks by reducing the attack surface on the client.

Consider a dashboard with 10,000 product rows. With classic SSR, you'd send all 10,000 rows to the client, along with the JavaScript to filter them. That's a huge network payload and client-side processing burden. With RSC, you'd send maybe 50 rows (the current view) and the client-side JavaScript would be minimal. When the user filters, the server re-fetches the new 50 rows and sends only the diff. This is a major shift for data-intensive applications.

RSC also simplifies data fetching. In the app/products/page.tsx example, the Server Component directly calls fetchFilteredProductsFromDB. There's no need for useEffect hooks, useState for data, or client-side data fetching libraries for the core data. This makes the code cleaner and easier to reason about, as data fetching is colocated with the components that use it, much like PHP or Ruby on Rails templates, but with the power of React's component model. This architectural shift also impacts how we think about caching and data consistency, often leveraging HTTP caching and the React cache function on the server.

The conceptual difference between SSR and RSC is profound. SSR is about rendering HTML on the server before sending it to the client for hydration. RSC is about rendering components on the server, which then stream their rendered output (a special kind of JSON) to the client. The client then uses a minimal React runtime to assemble this stream into the DOM. This distinction is crucial for understanding why they solve completely different problems, moving beyond just "rendering on the server" to "where computation happens."

6. Network Waterfalls, TTFB, FCP, and INP Benchmarks

Page load times and responsiveness are not just about raw speed. They're about user perception. A technically fast page can feel slow if the user can't interact with it quickly. We often measure Time to First Byte (TTFB), First Contentful Paint (FCP), and Largest Contentful Paint (LCP) to track how quickly content appears. However, these don't tell the whole story. Total Blocking Time (TBT) and Interaction to Next Paint (INP) are crucial for understanding interactivity—how quickly the page responds to user input.

React Server Components (RSCs) and traditional Server-Side Rendering (SSR) approach these metrics from fundamentally different angles. SSR sends a complete, fully rendered HTML document, often with a large JavaScript bundle that then "hydrates" the page on the client. RSCs, on the other hand, stream HTML and only send the absolute minimum JavaScript needed for interactive client components. This difference has profound implications across various network conditions and device capabilities.

6.1. The Performance Metrics That Actually Matter (and Why They're Tricky)

Measuring web performance means looking beyond simple load times. TTFB is the first step: it's the time from the user's request until the first byte of the response arrives from the server. A low TTFB indicates a fast server and network connection to the server. For RSCs, TTFB is critical because the initial HTML stream starts immediately. For SSR, it's also important, as the full HTML payload depends on this.

FCP and LCP measure when content becomes visible. FCP is when any part of the page's content is rendered. LCP identifies the largest image or text block visible within the viewport. Both are key indicators of perceived loading speed. RSCs can often achieve a faster FCP by streaming initial HTML, allowing the browser to render parts of the page as they arrive, even before all data is ready. This is where React's built-in Suspense functionality shines, enabling progressive rendering. You can learn more about how Suspense works in the official React Suspense Streaming Reference (react.dev).

However, a fast FCP or LCP doesn't guarantee a usable page. This is where TBT and INP come in. Total Blocking Time (TBT) measures the sum of all time periods where the main thread was blocked for long enough (over 50ms) to prevent user input responsiveness. High TBT means the browser is busy parsing, compiling, and executing JavaScript, making the page feel frozen. Interaction to Next Paint (INP) measures the latency of all user interactions with a page. It reports the single longest duration from when a user interacts (e.g., clicks, taps, types) until the browser paints the next frame showing the visual update. A low INP means the page feels snappy and responsive to user actions. These metrics directly correlate with the amount of JavaScript sent to the client and executed there.

The trick with these metrics is that they are highly sensitive to network speed, device CPU, and the size of your JavaScript bundle. A page that performs well on a fast fiber connection with a high-end laptop might crumble on a slow 3G connection with an older smartphone. Our goal is to make the experience consistent and robust across this spectrum.

6.2. Benchmarking Across Network Conditions: RSC vs. SSR Deep Dive

Let's consider a common scenario: a product listing page. This page displays 10 products, each with an image, title, description, and price. It also includes a client-side search bar and a "Add to Cart" button for each product.

We'll compare two implementations:

  1. Traditional SSR (Next.js Pages Router style, or a similar full hydration model): The server fetches all product data, renders the full HTML, and sends a substantial JavaScript bundle for client-side interactivity.
  2. React Server Components (Next.js App Router): The server fetches product data, renders the product list as RSCs, streaming the HTML. Only the search bar and "Add to Cart" buttons are marked as use client components, sending minimal JavaScript.

Our test conditions will simulate real-world usage:

  • Fiber (Desktop): Fast network (100 Mbps down/up), high-end CPU.
  • Mobile 4G (Mid-range Smartphone): Moderate network (10 Mbps down/2 Mbps up), average CPU.
  • Slow 3G (Low-end Smartphone): Slow network (750 Kbps down/250 Kbps up), slow CPU.

Here's a simplified view of the performance metrics we'd expect:

Metric / NetworkTraditional SSR (Hypothetical)React Server Components (Hypothetical)
Fiber (Desktop)
Payload Size (HTML + JS)400 KB120 KB
TTFB150 ms150 ms
FCP400 ms350 ms
LCP700 ms600 ms
TBT80 ms10 ms
INP120 ms30 ms
Mobile 4G (Mid-range)
Payload Size (HTML + JS)400 KB120 KB
TTFB300 ms300 ms
FCP1200 ms900 ms
LCP2000 ms1500 ms
TBT350 ms40 ms
INP600 ms90 ms
Slow 3G (Low-end)
Payload Size (HTML + JS)400 KB120 KB
TTFB900 ms900 ms
FCP3500 ms2500 ms
LCP6000 ms4000 ms
TBT1500 ms120 ms
INP2500 ms200 ms

Let's break down these numbers. Payload Size is the most striking difference. RSCs send significantly less JavaScript to the client. This is because the entire product list rendering logic stays on the server. Only the interactive parts, like the AddToCartButton or SearchBar components, contribute to the client-side bundle. This reduction is a direct consequence of careful use client boundary management, a topic we explored in detail in The "use client" Boundary Trap: 7 React Server Component Mistakes That Bloat Your Bundle.

TTFB remains similar between both approaches because the server still needs to process the request and start sending data. The server-side data fetching and rendering logic are largely comparable until the response starts streaming.

FCP and LCP show a noticeable improvement with RSCs, especially on slower networks. This is due to streaming. The browser can start rendering the header, navigation, and even the first few products as soon as their HTML arrives, even if the database query for the last product is still running. Traditional SSR typically waits for the entire HTML document to be ready before sending it. You can see how LCP is measured and why it matters in the web.dev Largest Contentful Paint (LCP) Guide.

The most dramatic improvements are seen in TBT and INP. These metrics directly reflect the client-side JavaScript workload. With traditional SSR, a 400KB JavaScript bundle needs to be downloaded, parsed, compiled, and executed on the client. On a low-end smartphone with a slow CPU, this can block the main thread for over a second, making the page completely unresponsive. RSCs, by sending only 120KB of JavaScript, drastically reduce this blocking time. The client spends less time processing code and more time being available for user interactions.

Here's a simple RSC example for our product list:

app/products/page.tsx
import { Suspense } from 'react';
import { fetchProducts } from '@/lib/data'; // Server-side data fetching
import ProductCard from '@/components/ProductCard'; // An RSC component
import SearchBar from '@/components/SearchBar'; // A 'use client' component

// This is a React Server Component (default in App Router)
export default async function ProductsPage({
  searchParams,
}: {
  searchParams: { query?: string };
}) {
  const query = searchParams.query || '';
  // Data fetching happens directly on the server, no API route needed
  // This function can directly query your database or internal services
  const products = await fetchProducts(query);

  return (
    <div className="container mx-auto px-4 py-8">
      <h1 className="text-3xl font-bold mb-6">Our Products</h1>

      {/* SearchBar is a client component, it will be bundled */}
      {/* It receives a server-rendered default value and client-side updates */}
      <SearchBar initialQuery={query} /> 

      <Suspense fallback={<p>Loading products...</p>}>
        {/* The ProductList component is also an RSC, fetching its own data */}
        <ProductList products={products} /> 
      </Suspense>
    </div>
  );
}

// Another RSC that renders the actual list
async function ProductList({ products }: { products: any[] }) {
  // This component also runs on the server
  // It receives already fetched data from its parent RSC
  return (
    <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mt-8">
      {products.map((product) => (
        <ProductCard key={product.id} product={product} /> // ProductCard is an RSC
      ))}
      {products.length === 0 && <p className="col-span-full text-center text-gray-600">No products found.</p>}
    </div>
  );
}
components/ProductCard.tsx
import AddToCartButton from './AddToCartButton'; // This is a 'use client' component

// This is a React Server Component
// It renders the static parts of the product card
export default function ProductCard({ product }: { product: any }) {
  return (
    <div className="border rounded-lg shadow-md p-4 flex flex-col">
      <img src={product.imageUrl} alt={product.name} className="w-full h-48 object-cover mb-4 rounded" />
      <h2 className="text-xl font-semibold mb-2">{product.name}</h2>
      <p className="text-gray-700 mb-3 flex-grow">{product.description.substring(0, 100)}...</p>
      <div className="flex justify-between items-center mt-auto">
        <span className="text-lg font-bold">${product.price.toFixed(2)}</span>
        {/* AddToCartButton is a client component. It needs client-side JS for interaction. */}
        {/* Only this small part of the UI triggers client-side bundling. */}
        <AddToCartButton productId={product.id} />
      </div>
    </div>
  );
}

In this setup, ProductsPage and ProductList and ProductCard are all RSCs. They fetch data and render HTML on the server. Only SearchBar and AddToCartButton are client components. This drastically shrinks the client-side JavaScript bundle, leading to the TBT and INP improvements we observed.

6.3. The Hidden Cost of Client-Side JavaScript: CPU and Battery Drain

The performance numbers above highlight a critical, often overlooked cost: client-side JavaScript execution. Every kilobyte of JavaScript sent to the browser isn't just a network payload; it's a computational burden. The browser has to download it, parse it, compile it, and then execute it. This process consumes CPU cycles and, consequently, battery life.

On high-end desktops connected via fiber, this cost is often negligible. The CPU is fast, and power is abundant. However, the majority of global internet users access the web on mobile devices, often with slower processors and limited battery capacity. A large JavaScript bundle, even if cached, still requires significant processing on subsequent visits if the application needs to re-hydrate or re-initialize.

Consider a large e-commerce site. A traditional SSR approach might send a 500KB+ JavaScript bundle containing all the logic for product filters, carousels, modals, cart management, user authentication, and analytics. When this bundle loads:

  1. Parsing: The browser reads the JavaScript code, checking for syntax errors.
  2. Compilation: The JavaScript engine converts the code into machine-executable bytecode.
  3. Execution: The code runs, setting up event listeners, rendering client-side UI, and performing hydration.

Each of these steps can block the main thread, leading to high TBT and poor INP. On a low-end Android phone, these operations can take hundreds of milliseconds, or even seconds, draining the battery faster. This is particularly noticeable with complex client-side data fetching libraries like TanStack Query (previously React Query), which, while powerful, add to the client-side bundle and hydration cost if not managed carefully. The TanStack Query Official Documentation is a great resource for understanding its capabilities, but remember its client-side implications.

RSCs fundamentally shift this burden to the server. The server, typically running on powerful machines with ample resources, handles most of the rendering and data fetching. The client receives only the HTML and the minimal JavaScript required for truly interactive elements. This means:

  • Less CPU on client: Less parsing, compilation, and execution.
  • Reduced battery drain: The device's processor isn't working as hard.
  • Better thermal performance: Your phone won't get as hot.

This is a significant win for user experience, especially in emerging markets or for users with older devices. It's a key reason why adopting an "Edge-First" architecture with RSCs, as discussed in Edge-First Systems: Building Resilient Microservices with Next.js 15 & Turbopack, is so impactful. By moving computation closer to the user or to powerful server infrastructure, we offload the client.

Architecture Note

[!NOTE] Even with RSCs, it's easy to accidentally bloat your client bundle. Components that seem static but import a use client component (even deeply nested) will cause the entire subtree to be included in the client bundle. Always audit your bundle size using tools like Next.js Bundle Analyzer to identify and prune unnecessary client-side JavaScript.

6.4. Practical Strategies for Optimizing Performance with RSCs

The benchmarks clearly demonstrate that RSCs solve the problem of client-side JavaScript bloat and its associated performance penalties (high TBT, INP, CPU/battery drain). Traditional SSR, while providing an initial HTML payload, still requires full hydration of a potentially large client-side bundle. Here's how to leverage RSCs for optimal performance:

  1. Default to Server Components: In the Next.js App Router, components are RSCs by default. Embrace this. Only mark components with 'use client' when they absolutely require client-side interactivity, such as state, effects, or browser APIs. Think of use client as an opt-out, not an opt-in.

  2. Keep use client Boundaries Tight: Encapsulate client-side logic in the smallest possible components. For example, a "Like" button should be a use client component, but the product card containing it should remain an RSC. Passing children from an RSC to a client component is an effective pattern for this, as the children remain server-rendered until they hit the client boundary.

  3. Leverage Data Fetching on the Server: All your data fetching should ideally happen in RSCs. This keeps sensitive API keys off the client and reduces client-side data fetching libraries. For example, instead of using fetch in a useEffect hook on the client, call your data fetching logic directly in your RSCs. If you need to cache data fetches across requests or within a single request, utilize the cache function from React or the 'use cache' directive in Next.js, as detailed in the Next.js 'use cache' Directive Reference. This ensures efficient server-side data retrieval.

  4. Use Suspense for Progressive Loading: Combine RSCs with React Suspense to stream parts of your page. If a slow database query delays one section, the rest of your page can still render and become interactive. This improves perceived performance significantly, especially for LCP.

  5. Be Mindful of Third-Party Libraries: Many third-party libraries assume a client-side environment. When integrating them, try to isolate them within use client components. If a library is purely for server-side operations (e.g., Markdown parsing), ensure it's only imported and used within RSCs. Sometimes, a library might have both server and client parts. For example, a rich text editor needs client-side JS, but its static display component could be an RSC.

  6. Validate Data Schemas on the Server: When fetching data, validating its structure is crucial. Perform this validation on the server using tools like Zod or similar schema validators. This prevents malformed data from ever reaching the client and simplifies client-side code. If you're dealing with complex JSON responses, tools like our Free Client-Side JSON to TypeScript & Zod Schema Generator can help you quickly generate robust schemas for server-side validation.

By focusing on these strategies, you can significantly reduce the client-side footprint of your React applications. RSCs are not a magic bullet for all performance problems, but they are a powerful tool for tackling the specific challenge of excessive client-side JavaScript and its impact on core web vitals, particularly TBT and INP, across diverse network and device conditions. They empower us to build truly performant and resilient web experiences.

7. Edge Cases: When SSR Happens on Client Components Too

Many developers hit a wall with React Server Components (RSC) when they first see a window is not defined error. This happens even in files marked 'use client'. It's a common surprise. The 'use client' directive doesn't mean "this component only runs in the browser." It means "this component's interactivity and state management must happen in the browser." However, its initial render still occurs on the server.

The server needs to generate the first HTML payload for your application. This HTML includes the output of all components, whether they are Server Components or Client Components. This initial server-side render (SSR) of Client Components is crucial for several reasons. It provides a fast first paint, showing users content immediately without waiting for JavaScript to download and execute. It also ensures your content is available to search engine crawlers, which improves SEO. Without this SSR step, your users would see a blank page, and search engines would struggle to index your dynamic content.

The window is not defined Trap

The core problem arises when a Client Component tries to access browser-specific APIs during this initial server-side render. The server environment, typically Node.js, does not have a window object, a document object, or localStorage. These are browser APIs. When your component code tries to use window.innerWidth or localStorage.getItem('theme') directly in its render function (or at the module level), the server throws an error.

Here's what a breaking component might look like:

app/components/ThemeToggle.tsx
'use client'; // This component will run on the client for interactivity

import { useState, useEffect } from 'react';

export default function ThemeToggle() {
  // This line runs during the initial server-side render
  // and will cause an error because `localStorage` does not exist on the server.
  const [theme, setTheme] = useState(() => localStorage.getItem('theme') || 'light');

  useEffect(() => {
    document.documentElement.setAttribute('data-theme', theme);
    localStorage.setItem('theme', theme);
  }, [theme]);

  const toggleTheme = () => {
    setTheme((prevTheme) => (prevTheme === 'light' ? 'dark' : 'light'));
  };

  return (
    <button onClick={toggleTheme}>
      Switch to {theme === 'light' ? 'Dark' : 'Light'} Mode
    </button>
  );
}

When this component is rendered on the server, you'll see an error similar to this in your terminal:

Code
ReferenceError: localStorage is not defined
    at ThemeToggle (webpack-internal:///(app-client)/./app/components/ThemeToggle.tsx:7:38)
    at renderWithHooks (node_modules/react-dom/cjs/react-dom-server.node.development.js:5651:16)
    at renderIndeterminateComponent (node_modules/react-dom/cjs/react-dom-server.node.development.js:5724:15)
    at renderElement (node_modules/react-dom/cjs/react-dom-server.node.development.js:6011:7)
    at renderNodeDestructuring (node_modules/react-dom/cjs/react-dom-server.node.development.js:6039:5)
    at renderNode (node_modules/react-dom/cjs/react-dom-server.node.development.js:6088:12)
    at renderChildrenArray (node_modules/react-dom/cjs/react-dom-server.node.development.js:5916:7)
    at renderNodeDestructuring (node_modules/react-dom/cjs/react-dom-server.node.development.js:6061:5)
    at renderNode (node_modules/react-dom/cjs/react-dom-server.node.development.js:6088:12)
    at renderChildrenArray (node_modules/react-dom/cjs/react-dom-server.node.development.js:5916:7)

This error explicitly tells you localStorage isn't defined. It's happening during the server-side rendering phase of your Client Component. The server is trying to evaluate the default state of your useState hook, which attempts to read localStorage.

Robust Strategies for Client-Side Logic

Handling browser-specific code in Client Components requires careful placement. You need to ensure such code only runs after the component has hydrated in the browser.

1. Using useEffect for Browser-Specific Side Effects

The useEffect hook is your primary tool for this. Code inside useEffect runs only on the client, and after the initial render. This makes it perfect for interacting with window, document, or localStorage.

Let's fix the ThemeToggle component:

app/components/ThemeToggle.tsx
'use client';

import { useState, useEffect } from 'react';

export default function ThemeToggle() {
  // Initialize theme to a default value like 'light'.
  // We'll read from localStorage inside useEffect.
  const [theme, setTheme] = useState('light');
  const [mounted, setMounted] = useState(false); // Track if component has mounted on client

  // This useEffect runs only on the client, after initial render
  useEffect(() => {
    // Check if localStorage exists before trying to use it.
    // This is a safety measure, though `useEffect` itself implies client-side.
    if (typeof window !== 'undefined' && localStorage.getItem('theme')) {
      setTheme(localStorage.getItem('theme') || 'light');
    }
    setMounted(true); // Mark as mounted
  }, []); // Empty dependency array means it runs once after initial client render

  // This useEffect updates localStorage and the document element
  // whenever the theme state changes, but only after mounting.
  useEffect(() => {
    if (mounted) { // Only run this effect after the component has mounted on the client
      document.documentElement.setAttribute('data-theme', theme);
      localStorage.setItem('theme', theme);
    }
  }, [theme, mounted]); // Re-run when theme or mounted state changes

  const toggleTheme = () => {
    setTheme((prevTheme) => (prevTheme === 'light' ? 'dark' : 'light'));
  };

  // Render a placeholder or null until the theme is correctly set on the client
  // to avoid hydration mismatches if the server rendered 'light' but client reads 'dark'.
  if (!mounted) {
    return null; // Or a simple loading spinner if you prefer
  }

  return (
    <button onClick={toggleTheme}>
      Switch to {theme === 'light' ? 'Dark' : 'Light'} Mode
    </button>
  );
}

In this corrected version, the useState hook initializes theme to a safe default ('light') that works on both the server and client. The actual read from localStorage happens within the first useEffect. This ensures the code only executes in the browser environment, preventing the localStorage is not defined error. The mounted state helps prevent hydration mismatches by ensuring the component only renders its final UI after client-side state is established.

Engineering Tip

[!TIP] Always initialize state with server-safe defaults in Client Components. Then, use useEffect to hydrate or update that state with browser-specific values after the component mounts on the client. This pattern prevents window is not defined errors and helps avoid hydration mismatches.

2. Dynamic Imports for Client-Only Components

Sometimes, an entire component, or a large part of it, is inherently client-side. This could be a complex charting library, a video player, or any component that makes heavy use of browser-specific APIs and doesn't need to be part of the initial HTML payload. For these scenarios, dynamic imports are ideal.

Next.js provides next/dynamic which allows you to import components dynamically and even disable SSR for them. This means the component's code will only be loaded and executed on the client, and the server will render nothing for it initially, or a specified fallback.

app/components/ClientOnlyChart.tsx
'use client'; // This component will eventually run on the client

import { useEffect, useRef } from 'react';
import Chart from 'chart.js/auto'; // Assuming 'chart.js' is a client-side library

export default function ClientOnlyChart() {
  const chartRef = useRef(null);
  const chartInstance = useRef(null);

  useEffect(() => {
    if (chartRef.current) {
      if (chartInstance.current) {
        chartInstance.current.destroy(); // Destroy previous chart instance if it exists
      }
      // This code only runs on the client where `document` and `window` exist
      chartInstance.current = new Chart(chartRef.current, {
        type: 'bar',
        data: {
          labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
          datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3],
            backgroundColor: 'rgba(75, 192, 192, 0.2)',
            borderColor: 'rgba(75, 192, 192, 1)',
            borderWidth: 1,
          }],
        },
        options: {
          responsive: true,
          maintainAspectRatio: false,
          scales: {
            y: {
              beginAtZero: true,
            },
          },
        },
      });
    }

    return () => {
      if (chartInstance.current) {
        chartInstance.current.destroy(); // Clean up chart on unmount
      }
    };
  }, []);

  return (
    <div style={{ width: '100%', height: '300px' }}>
      <canvas ref={chartRef}></canvas>
    </div>
  );
}

Now, to use this component and ensure it never runs on the server:

app/dashboard/page.tsx
import dynamic from 'next/dynamic';
import { Suspense } from 'react';

// Dynamically import ClientOnlyChart, disabling SSR for it.
// This means the server will not even attempt to render it.
const DynamicClientOnlyChart = dynamic(() => import('../../components/ClientOnlyChart'), {
  ssr: false, // Crucial: tells Next.js not to render this on the server
  loading: () => <p>Loading chart...</p>, // Optional: show a fallback while JS loads
});

export default function DashboardPage() {
  return (
    <section>
      <h2>Dashboard Overview</h2>
      <p>Here's some server-rendered content.</p>
      {/* The chart will only load and render on the client */}
      <Suspense fallback={<p>Preparing interactive chart...</p>}>
        <DynamicClientOnlyChart />
      </Suspense>
      <p>More server-rendered content below the chart.</p>
    </section>
  );
}

By setting ssr: false, next/dynamic ensures that ClientOnlyChart is entirely skipped during the server-side render. The server will instead render the loading fallback (or nothing if no fallback is provided). The actual ClientOnlyChart component and its JavaScript bundle will only be sent to the browser and executed there. This is a powerful technique for code splitting and isolating client-specific logic. It also plays well with React's built-in Suspense for managing loading states, as discussed in our guide on Eliminating Request Waterfalls in React Server Components with Parallel Streaming & Suspense.

3. Conditional Browser API Access (typeof window)

For very minor, non-rendering logic, you might conditionally check for the window object. This is generally less preferred than useEffect or dynamic imports for anything that affects the rendered output, as it can still lead to hydration mismatches if not handled carefully. However, for utility functions or logging, it can be acceptable.

lib/utils.ts
export function logClientSideEvent(eventName: string, data: any) {
  if (typeof window !== 'undefined') { // Check if we are in a browser environment
    console.log(`Client-side event: ${eventName}`, data);
    // Potentially send to an analytics service like Google Analytics
    // window.gtag('event', eventName, data);
  } else {
    // Optionally log to server console during SSR
    console.log(`Server-side render attempted client event: ${eventName}`, data);
  }
}

This pattern is safest when the logic doesn't directly influence the JSX returned by a component. If it does, you're back to the hydration mismatch problem.

Real-World Debugging & Mental Models

I once debugged a production issue where a seemingly innocent Client Component for a custom analytics tracker was causing intermittent ReferenceError: document is not defined errors. The component was trying to read a custom attribute from the <body> tag directly in its render function to determine a user segment. Because this component was part of the initial page load, it hit the server during SSR. The fix involved moving that document access into a useEffect hook, ensuring it only ran after the component hydrated in the browser. The error disappeared, and our analytics continued to function correctly on the client.

The key mental model here is "server renders, client hydrates." The server's job is to build the initial HTML blueprint. It doesn't execute client-side JavaScript, but it does evaluate the component tree to figure out what HTML to send. Client Components are part of that tree. The browser's job is to take that HTML blueprint, download the JavaScript, and then "activate" (hydrate) the Client Components, attaching event listeners and managing state. This is why official documentation for React Server Components and the 'use client' directive emphasizes the distinct roles.

Understanding this distinction is critical for building robust applications with RSC. It ensures you leverage the best of both server and client environments. Tools like the Free JWT & Crypto Security Workbench might use client-side storage for temporary data, but the core logic for security operations often benefits from server-side execution with 'use server' functions, as outlined in the React 'use server' Server Functions Guide (react.dev). This hybrid approach provides flexibility.

By properly segregating your browser-specific code, you prevent runtime errors and ensure a smooth user experience, regardless of where your application code is executed. This careful architectural planning extends to deployment environments too, where understanding the differences in how Vercel vs. Netlify Edge Architecture Comparison handle server-side and client-side assets can further optimize performance.

8. Decision Guide & Frequently Asked Questions

Choosing how to render your React application isn't a single decision. It's a series of choices, made per route, or even per component. Each strategy—Client-Side Rendering (CSR), Server-Side Rendering (SSR), Static Site Generation (SSG), and React Server Components (RSC) with Streaming SSR—solves a specific set of problems. Understanding these differences helps you build fast, robust, and maintainable applications.

The key is to match the rendering strategy to the user's needs for that specific page or component. A marketing landing page has different requirements than an interactive user dashboard. A product detail page needs a blend of both.

Choosing the Right Rendering Strategy for Your Route

You wouldn't use a hammer to drive a screw. Similarly, one rendering strategy doesn't fit every part of your application. Think about your route's primary purpose: is it highly interactive, data-intensive, or mostly static content? This mental model guides your decision.

Client-Side Rendering (CSR) CSR means your browser downloads a minimal HTML shell and a large JavaScript bundle. The browser then fetches data and renders the entire UI. This is common for Single Page Applications (SPAs).

  • When to use it: Highly interactive dashboards, applications behind authentication walls, or internal tools where initial load time and SEO aren't critical. Think complex forms, real-time chats, or data visualization tools.
  • Trade-offs: Slower initial load (Time To First Byte, TTFB) because the browser must download, parse, and execute JavaScript before displaying content. Poor SEO by default, as search engine crawlers might see an empty page.
  • Example: An admin panel for managing users. After logging in, the user expects a highly responsive interface, and the initial blank screen is acceptable.

Server-Side Rendering (SSR) With traditional SSR, a server renders the full HTML for each request. This HTML is sent to the browser, which then "hydrates" it, attaching JavaScript event listeners to make it interactive.

  • When to use it: Pages requiring good SEO and a fast Time To First Contentful Paint (FCP), but with dynamic, user-specific data. E-commerce product listings, news articles, or user profiles are good candidates.
  • Trade-offs: Increased server load, as the server re-renders the page for every request. Can still have a noticeable "hydration" period where the page looks ready but isn't interactive.
  • Example: A search results page. The content is dynamic based on the user's query, but it needs to be visible and crawlable immediately.

Static Site Generation (SSG) SSG renders pages at build time. The pre-rendered HTML, CSS, and JavaScript are then served from a CDN. This is the fastest for initial load and excellent for SEO.

  • When to use it: Content that changes infrequently or not at all. Marketing landing pages, blogs, documentation sites, or "About Us" pages.
  • Trade-offs: Data isn't fresh unless you rebuild the site. Not suitable for highly dynamic content or user-specific data. Build times can become long for very large sites.
  • Example: A company's blog. Posts are written and published, then remain static until an update.

React Server Components (RSC) + Streaming SSR This is where things get interesting and where the "different problems" aspect truly shines. RSCs render purely on the server, never sending their JavaScript to the client. They handle data fetching and complex logic. Client Components ('use client') then provide interactivity, and they are streamed alongside server-rendered HTML. This combines the best of server-side data fetching with fine-grained client-side interactivity, minimizing client-side JavaScript bundles. You can read more about the core concepts in the React Server Components (RSC) Glossary Reference.

  • When to use it: Complex pages that need both fast initial render (for SEO and perceived performance) and rich interactivity. Think a product detail page with static product info, dynamic reviews, and an interactive "Add to Cart" button. It's ideal for pages with large, static parts and smaller, interactive islands.
  • Trade-offs: Introduces a new mental model for component types ('use client' vs. server components). Requires a Next.js-like framework to manage the server/client boundary effectively. Debugging can be more complex due to the distributed nature.
  • Example: An e-commerce product page. The main product description, image, and initial price are RSCs. A "wishlist" button, a quantity selector, and a user review submission form are client components. This ensures the critical product info loads instantly, while interactive elements hydrate gracefully.

Let's summarize these strategies in a comparison table:

Feature / StrategyClient-Side Rendering (CSR)Server-Side Rendering (SSR)Static Site Generation (SSG)React Server Components (RSC) + Streaming
Initial Load (TTFB)Slow (JS bundle download)Moderate (server renders HTML)Very Fast (CDN serves static HTML)Fast (server streams HTML & RSC payload)
InteractivityImmediate after JS loadAfter hydrationNone (pure HTML/CSS)Immediate for streamed parts, then client components hydrate
SEO FriendlinessPoor (requires JS execution)ExcellentExcellentExcellent (server-rendered HTML)
Data FreshnessAlways fresh (client fetches)Always fresh (server fetches on request)Stale (built at deploy)Always fresh (server fetches on request)
Server LoadLow (serves static assets)High (renders per request)None (build-time only)Moderate (renders per request, but less JS for client)
Client JS Bundle SizeLarge (full app logic)Large (full app logic for hydration)Small (if any interactivity)Smallest (only client components JS)
ComplexityLow to ModerateModerateLowHigh (new mental model, framework required)
Best ForDashboards, authenticated appsDynamic, SEO-critical pagesBlogs, marketing sites, docsComplex, dynamic pages needing optimal UX/perf

Real-World Scenarios and Production Considerations

Most modern applications use a blend of these strategies. A single Next.js application, for instance, can leverage SSG for its blog, SSR for its dynamic product pages, and RSCs for components within those pages, with CSR taking over for specific interactive elements. This flexibility is powerful.

Consider a product detail page (/products/[id]).

  1. The core product information (name, description, price, static images) is perfect for a Server Component. It fetches data directly from your database, say PostgreSQL vs. Supabase Architecture Benchmark, without an API call from the browser. This keeps the client bundle small.
  2. A "Add to Cart" button, a quantity selector, and a dynamic customer review section need client-side interactivity. These are marked with 'use client'. They receive props from their parent Server Component and manage their own state and events.
  3. The entire page can be streamed using React Suspense, allowing parts like the product description to appear immediately while the slower-loading review section streams in later. This is a powerful pattern for perceived performance. You can learn more about this in the React Suspense Streaming Reference (react.dev).

Here's how such a page might look:

app/products/[id]/page.tsx
// This is a Server Component by default in Next.js App Router
import { Suspense } from 'react';
import { getProductDetails, getProductReviews } from '@/lib/dal'; // Server-side data access layer
import ProductImageGallery from '@/components/product-image-gallery'; // Could be a Server Component
import AddToCartButton from '@/components/add-to-cart-button'; // This will be a Client Component
import ProductReviews from '@/components/product-reviews'; // This will be a Client Component

interface ProductPageProps {
  params: { id: string };
}

export default async function ProductPage({ params }: ProductPageProps) {
  const productId = params.id;

  // Fetch product details directly on the server. No API endpoint needed.
  // This data is available to the Server Component and can be passed to Client Components as props.
  const product = await getProductDetails(productId); 

  if (!product) {
    return <div>Product not found.</div>;
  }

  return (
    <div className="container mx-auto p-4">
      <h1 className="text-3xl font-bold mb-4">{product.name}</h1>
      <p className="text-lg text-gray-700 mb-6">{product.description}</p>
      
      {/* ProductImageGallery could be a Server Component if it just displays static images */}
      <ProductImageGallery images={product.images} /> 
      
      <div className="flex items-center justify-between my-8">
        <span className="text-2xl font-semibold">${product.price.toFixed(2)}</span>
        
        {/* AddToCartButton is a Client Component. It needs 'use client' at its top.
            It receives server-fetched data as props. */}
        <AddToCartButton productId={product.id} productName={product.name} />
      </div>

      <hr className="my-8" />

      <h2 className="text-2xl font-bold mb-4">Customer Reviews</h2>
      {/* ProductReviews is a Client Component. It might fetch its own dynamic data 
          or receive initial data from the Server Component.
          Using Suspense here allows the reviews to load independently and not block the main product content. */}
      <Suspense fallback={<div>Loading reviews...</div>}>
        <ProductReviews productId={product.id} />
      </Suspense>
    </div>
  );
}
components/add-to-cart-button.tsx
'use client'; // This directive marks the component as a Client Component.

import { useState } from 'react';
import { addToCart } from '@/lib/cart-actions'; // This could be a 'use server' function

interface AddToCartButtonProps {
  productId: string;
  productName: string;
}

export default function AddToCartButton({ productId, productName }: AddToCartButtonProps) {
  const [quantity, setQuantity] = useState(1);
  const [isAdding, setIsAdding] = useState(false);

  const handleAddToCart = async () => {
    setIsAdding(true);
    try {
      // Call a server action to update the cart
      await addToCart(productId, quantity); // This 'addToCart' function is likely a 'use server' action
      alert(`${quantity} of ${productName} added to cart!`);
    } catch (error) {
      console.error("Failed to add to cart:", error);
      alert('Failed to add item to cart.');
    } finally {
      setIsAdding(false);
    }
  };

  return (
    <div className="flex items-center space-x-2">
      <input
        type="number"
        min="1"
        value={quantity}
        onChange={(e) => setQuantity(Number(e.target.value))}
        className="w-16 p-2 border rounded"
      />
      <button
        onClick={handleAddToCart}
        disabled={isAdding}
        className="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 disabled:opacity-50"
      >
        {isAdding ? 'Adding...' : 'Add to Cart'}
      </button>
    </div>
  );
}

This setup demonstrates how Server Components fetch initial data, and Client Components provide interactivity. The AddToCartButton uses a useState hook and likely calls a server action defined with 'use server' to update the cart on the backend. This pattern keeps the client bundle lean, as the server handles heavy data fetching and rendering. More details on use client and use server can be found in the official React 'use client' Directive Specification (react.dev) and React 'use server' Server Functions Guide (react.dev).

Engineering Tip

[!TIP] When debugging performance issues in a mixed RSC/Client Components app, always check the network waterfall. Pay attention to the initial HTML download, the RSC payload, and then individual client component JavaScript bundles. A large client bundle often indicates too much logic or too many third-party libraries are being included in client components that could potentially be moved to the server.

Frequently Asked Questions (AIEO Quick Reference)

What is the main difference between React Server Components (RSC) and traditional Server-Side Rendering (SSR)?

Traditional SSR renders all React components to HTML on the server, then sends all their JavaScript to the client for hydration. RSCs render only specific components on the server, never sending their JavaScript to the client. This dramatically reduces client-side bundle size, improving initial load and performance.

When should I choose CSR over SSR or RSC?

Choose CSR for highly interactive, authenticated applications like internal dashboards or complex editors where initial SEO isn't critical. The benefit is often simpler deployment and potentially faster subsequent page navigations within the SPA, but at the cost of initial load time and SEO.

Can I use SSR and RSC together in the same application?

Yes, absolutely. Frameworks like Next.js allow you to use traditional SSR for entire pages (e.g., getServerSideProps in Pages Router) and RSCs for components within those pages (App Router default). RSCs often enhance SSR by allowing parts of the page to be rendered without client JS.

Do React Server Components improve SEO?

Yes, RSCs significantly improve SEO. They render content on the server, providing search engine crawlers with fully formed HTML. This ensures all your content is visible and indexable immediately, without relying on JavaScript execution in the browser.

What are the performance benefits of using React Server Components?

RSCs reduce the JavaScript bundle size sent to the client, leading to faster initial page loads and improved Time To Interactive (TTI). By moving data fetching and rendering logic to the server, they offload work from the client's browser, especially on slower networks or less powerful devices.

Are there any downsides or complexities with React Server Components?

Yes, RSCs introduce a new mental model, requiring developers to distinguish between Server and Client Components and understand their boundaries. Debugging can be more complex due to the distributed nature of rendering. They also generally require a meta-framework like Next.js for effective implementation.

How do use client and use server directives fit into this?

'use client' explicitly marks a component or module as needing to run on the client. It's for interactivity, state, and browser APIs. 'use server' marks a function as a "Server Action" that can be called directly from the client, allowing secure server-side mutations or data updates without explicit API endpoints.

Which rendering strategy is best for a blog or documentation site?

Static Site Generation (SSG) is generally the best choice for blogs or documentation sites. The content changes infrequently, and SSG provides the fastest possible load times and excellent SEO by pre-rendering all pages at build time. This ensures a great user experience and high search engine visibility. For even better search engine visibility, consider using a Free SEO & AIEO Schema Generator.

Verified Engineering References & Further Reading

Official Specifications & Primary Documentation

Key Takeaways

  • SSR generates initial HTML for fast first paint but requires downloading and executing the full client JavaScript bundle for hydration.
  • React Server Components execute exclusively on the server, sending zero component JavaScript to the browser to permanently reduce client bundle size.
  • SSR and RSC are complementary: SSR optimizes initial page load speed, while RSC enables fresh server UI refetching on navigation without losing client state.
Mubashir Arham
Written & Verified byLast Verified: 2026-01-16

Mubashir Arham

Founder & Principal Systems Architect

Founder, CEO, and Principal Full-Stack & AI Systems Architect at FutureStack (futurestack.online). Writing deeply researched monographs on AI inference, distributed systems, and modern web runtimes.

Read all publications by Mubashir Arham
Related Engineering Workbench

Free Client-Side AI & Systems Calculators

Size GPU KV-cache VRAM, estimate LLM token costs, audit JWTs, or generate Zod schemas with zero server uploads.

Explore Free Developer Tools
Next in Track • Web & Edge Runtime

React Server Components Without Next.js: Using RSC with Vite, Waku, and React Router 7

You don't need Next.js to use React Server Components anymore. Explore how the Vite Environment API, Waku, and React Router 7 let you run RSC on any Node, Bun, Cloudflare, or Docker server.

Read Next Investigation
Interactive Practice • Free No Login

Test this topic live in Fusta AI Code Canvas

Ask follow-up questions or generate a working React, TypeScript, or Python example based on “React Server Components vs. SSR: Why They Solve Completely Different Problems”.

Deliberations (0)

Moderated • Anti-Spam & Link Safety Active

Contribute your perspective

Loading discussion thread...