Back to blog
tutorial · 6 min read

Islands Architecture: Why Your Site Doesn't Need All That JavaScript

E
Eastvale Team

Astro Islands Architecture

When you build with React or Next.js, every component ships JavaScript to the browser — even the ones that never change. A static heading, a footer, a card grid — all hydrated, all adding to your bundle.

Astro’s Islands Architecture takes a different approach. By default, components render to HTML with zero JavaScript. You opt-in to interactivity only where it matters.


How It Works

Think of your page as an ocean of static HTML. Interactive components — a carousel, a search bar, a dark mode toggle — are “islands” of JavaScript in that ocean.

---
import Counter from '../components/Counter.jsx';
---
<h1>This is static HTML</h1>
<Counter client:visible />

The client:visible directive tells Astro: “Only load this component’s JavaScript when it scrolls into view.” Your heading? Pure HTML. No JS overhead.


The Performance Impact

In our course project — a documentation site — switching from Next.js to Astro dropped the JavaScript bundle from 180KB to 12KB. Same features, same design. Just smarter hydration.


When to Use Islands

Use CaseDirectiveDescription
Forms and inputsclient:loadHydrate the component immediately on page load.
Below-the-fold widgetsclient:visibleHydrate only when the component enters the viewport.
Lower priority interactionsclient:idleHydrate once the main thread is free (requestIdleCallback).

The key insight: Most of your site is static. Treat it that way.


Would you like me to create a Tailwind CSS-styled layout for this content?