Course contentsShow
← React
Lesson 1532 of 2,39638. Server Components FundamentalsFree lesson

Re-rendering Without Full Page Reload

When Server Component data changes, React can re-fetch and patch just that component without losing client state.

Re-rendering Without Full Page Reload

What you'll learn: How React updates Server Components without losing your client-side state or forcing a full page refresh.

One of the most powerful features of Server Components is their ability to re-fetch and update without behaving like traditional server-side rendering, where every data change means a complete page reload.

The Traditional Problem

In classic server-rendered apps, when data changes on the server, you'd typically refresh the entire page. This means:

  • All JavaScript state gets reset
  • Form inputs lose their values
  • Scroll positions jump back to top
  • Loading spinners disappear and reappear

How React Solves This

When a Server Component needs fresh data, React can:

  1. Re-run just that component on the server
  2. Send down the new RSC wire format
  3. Patch only the changed parts of your UI
  4. Preserve all client state, scroll position, and focus

Think of it like replacing a single panel in a comic strip rather than reprinting the entire page. The panels around it (your Client Components with their state) stay exactly as they were.

What Gets Preserved

During a Server Component refresh:

  • Client Component state (useState, useRef) remains intact
  • Form inputs keep their values
  • Scroll positions don't jump
  • Focus stays where it was
  • CSS animations continue

The Mental Model

Server Components act like "data holes" in your UI. When they refresh, React fills those holes with new content while keeping everything else stable. Your useState counters, form inputs, and accordion open/closed states all survive the update.

Key Takeaway: Server Components can re-fetch and re-render without causing full page reloads, preserving all client state and providing a seamless, SPA-like experience even though the data comes from the server.