🔥 All-Access Pass — $199 USD (Regular $499) · Unlock all 2,836 Astro themes ➔
komal.nakrani
Get All-Access Pass ($199)
ThemesCategoriesDocsBlogTips & TricksPricingGet All-Access Pass ($199)
Comparisons••By Komal Nakrani

Astro Islands vs Server Components: Key Differences

Astro islands vs React Server Components: how each splits server and client code, what ships to the browser, state, routing and data fetching, with code and a verdict.

#Astro#Islands#React Server Components#Architecture

Astro islands vs server components is a question of where the default sits. In Astro, the page is static HTML and you opt individual components into the browser with client:* directives; each island hydrates on its own. In React Server Components (RSC), the whole app is one React tree rendered on the server, and components marked 'use client' are sent to the browser and hydrated as part of that tree. Both aim to ship less JavaScript, but Astro starts from HTML and adds interactivity, while RSC starts from a React app and removes client code where it can.

Key Takeaways

  • Astro: server-rendered HTML by default, zero JavaScript until a component gets a client:* directive.
  • RSC: server components never ship to the browser; 'use client' components and the React runtime always do.
  • Astro islands are independent roots, so they don’t share React context; RSC client components live in one tree.
  • Astro islands can be React, Svelte, Vue, Solid or Preact; RSC is React only and needs an RSC-capable framework.
  • Content sites usually ship less JavaScript with Astro; highly interactive apps often fit RSC better.

The mental model of Astro islands

An Astro page is an .astro component that runs on the server (at build time or per request) and outputs HTML. Framework components inside it render to HTML too. Only components you mark with a directive become islands: Astro includes their JavaScript and the framework runtime, and hydrates each one as a separate root.

---
// src/pages/posts.astro
import { getCollection } from 'astro:content';
import LikeButton from '../components/LikeButton.jsx';

const posts = await getCollection('blog');
---
<ul>
  {posts.map((post) => (
    <li>
      <a href={`/blog/${post.id}/`}>{post.data.title}</a>
      <LikeButton id={post.id} client:visible />
    </li>
  ))}
</ul>

The list, links and headings ship as HTML only. Each LikeButton hydrates when it scrolls into view. Navigation between pages is a normal browser page load unless you add Astro’s client router. The what is Astro guide and the client directive guide cover the details.

The mental model of React Server Components

React Server Components split a React tree into two kinds of components. Server components run only on the server: they can be async, read a database or file system directly, and their code never reaches the browser. Client components, marked with the 'use client' directive at the top of the file, render on the server for the initial HTML and then hydrate in the browser.

// app/posts/page.jsx (server component)
import { db } from '@/lib/db';
import LikeButton from './LikeButton';

export default async function PostsPage() {
  const posts = await db.post.findMany();
  return (
    <ul>
      {posts.map((post) => (
        <li key={post.id}>
          <a href={`/blog/${post.slug}/`}>{post.title}</a>
          <LikeButton id={post.id} />
        </li>
      ))}
    </ul>
  );
}
// app/posts/LikeButton.jsx
'use client';
import { useState } from 'react';

export default function LikeButton({ id }) {
  const [liked, setLiked] = useState(false);
  return <button onClick={() => setLiked(!liked)}>{liked ? 'Liked' : 'Like'}</button>;
}

The server sends HTML plus a serialized description of the tree (the RSC payload). The browser loads React, the framework’s router and the client components, then hydrates the client parts. On navigation, the router fetches a new RSC payload and React updates the page without a full reload. RSC is a React feature, but you use it through a framework that implements it, such as the Next.js App Router.

Astro islands vs server components at a glance

Astro islands React Server Components
Default output Static HTML, no JavaScript Server-rendered React tree
Opt into the browser with client:* directive at the usage site 'use client' at the top of the component file
JavaScript baseline None on pages without islands React runtime and framework router on every page
Hydration unit Each island separately Client components within one React root
Hydration timing load, idle, visible, media, only When the bundle loads (with Suspense boundaries)
Shared React context Not across islands Yes, across client components
Frameworks React, Preact, Svelte, Vue, Solid, Alpine.js React only
Navigation Full page loads (optional ClientRouter) Client-side router with RSC payloads
Data fetching Component frontmatter, at build or request time async server components
Mutations Astro Actions, API endpoints, forms Server Functions ('use server'), forms
Static output Default (astro build writes HTML) Possible, but framework-dependent
Deferred dynamic parts Server islands (server:defer) Suspense streaming

What ships to the browser

On an Astro page with no islands, the answer is HTML and CSS only. Add one React island and the page ships React, ReactDOM and that component, loaded according to its directive. A blog post with a single newsletter form might ship only that form’s code, and only once the reader scrolls to it.

With RSC, server components cost nothing in the browser, which is a real improvement over classic React apps that shipped every component. But the floor is higher: React, the framework’s client router and the RSC runtime load on every page so the app can hydrate and navigate. For an interactive application, that baseline is a fair price. For a mostly static article, it is overhead the page doesn’t need.

State, context and composition

This is where the models feel most different in practice.

In RSC, client components sit inside one React tree, so a ThemeProvider or CartProvider near the root is visible to every client component below it. Server components can also be passed as children to client components, so a client-side tab switcher can wrap server-rendered panels.

In Astro, each island is its own React root. Two React islands on the same page don’t share context. You share state with a framework-agnostic store such as Nano Stores, or by communicating through the DOM. Astro can pass server-rendered HTML into an island as children or slots, which covers the “client wrapper around server content” pattern, but that content is static HTML inside the island, not live React components. The React vs Svelte vs Vue for islands comparison shows a shared-store example.

Data fetching and server work

Both let you fetch data on the server without an API layer. In Astro, you write await in a component’s frontmatter; in a static build that runs once at build time, and in on-demand routes it runs per request. In RSC, an async server component awaits data directly, and the framework decides whether the result is cached, static or dynamic.

For mutations, Astro offers Actions (type-safe server functions callable from forms and client code) and API endpoints, both of which need on-demand rendering. RSC frameworks use Server Functions marked with 'use server'. The ideas are close; the main difference is that Astro’s mutations are explicit endpoints you call, while Server Functions are imported like regular functions. The Astro SSR guide explains how to run part of an Astro site on demand.

Astro’s server islands are the closest match to RSC streaming. A component with server:defer is skipped in the initial HTML, rendered on demand, and swapped in when ready, so a cached static page can still show a personalised header or cart count.

---
// src/pages/index.astro
import UserMenu from '../components/UserMenu.astro';
---
<header>
  <UserMenu server:defer>
    <a slot="fallback" href="/login/">Sign in</a>
  </UserMenu>
</header>

Routing and navigation

Astro is a multi-page architecture by default: every link is a real page load, which is simple, cache-friendly and hard to break. Add <ClientRouter /> if you want client-side navigation and persisted islands.

RSC frameworks are client-routed. Navigations fetch RSC payloads and React reconciles the new tree, preserving client state in shared layouts. This makes app-like experiences (dashboards, editors, multi-step flows) feel smoother, at the cost of more client code and more moving parts.

Choose Astro islands or React Server Components

Choose Astro islands if the site is mostly content (blogs, docs, marketing pages, portfolios, stores with simple carts), you want zero JavaScript on pages that don’t need it, static output with cheap hosting matters, or you want to mix UI frameworks.

Choose React Server Components if you are building an application where most pages are interactive, state must flow through shared layouts and providers, client-side navigation is central, and your team is all-in on React.

Combine them if you want both: Astro can render React components as islands, and a marketing site in Astro can sit beside an RSC app on a subdomain. Many teams run exactly that split.

For a broader framework-level comparison, read Astro vs Next.js. Komal themes are built on the islands model, which is why their pages ship as static HTML by default; you can browse the Astro themes to see that in practice, and the Astro pages docs explain how theme pages are structured. The official islands architecture docs and React’s Server Components reference are the primary sources for both models.

FAQ

Are Astro islands the same as React Server Components?

No. Both render most of the page on the server and ship less JavaScript, but Astro starts from static HTML and hydrates opt-in islands independently, while RSC renders one React tree on the server and hydrates client components within it. RSC always ships React and a router; an Astro page without islands ships no JavaScript.

Can I use React Server Components in Astro?

Astro does not use React Server Components. React components in Astro render to HTML on the server, and become interactive only as islands with a client:* directive. Astro’s own server-first features, such as component frontmatter, server islands and Actions, cover similar needs.

Which ships less JavaScript, Astro or RSC?

For content-heavy pages, Astro usually ships less, because a page with no islands sends no JavaScript and each island loads only its own code. RSC removes server components from the bundle but still loads React and the framework router on every page. For highly interactive apps, the difference narrows.

What is the Astro equivalent of ‘use client’?

The closest equivalent is a client:* directive such as client:load or client:visible, added where you use the component rather than in the component file. Without it, a framework component in Astro renders to HTML only, much like a server component.

What is the Astro equivalent of Suspense streaming?

Server islands. Add server:defer to a component and Astro renders the rest of the page first, then fetches and inserts that component when it is ready, with an optional fallback slot shown in the meantime. It suits personalised or slow parts of otherwise cached pages.