Skip to content
Quillyst
All posts

Astro islands in practice: shipping less JavaScript

How partial hydration changes the way you think about interactivity, with real-world patterns and trade-offs.

Ava Thompson1 min read

Most pages are mostly static. A blog post, a pricing page, a docs article — the bulk of the content never changes after it reaches the browser. Yet for years we shipped entire application runtimes to render them. Astro’s islands architecture flips that default.

What an island is

An island is an interactive component embedded in otherwise static HTML. Astro renders everything to HTML on the server, then hydrates only the components you explicitly mark:

---
import Counter from '../components/Counter.tsx';
---

<h1>Static heading — zero JS</h1>
<Counter client:visible />

The heading costs nothing. The counter loads its JavaScript only when it scrolls into view.

Choosing a client directive

Each directive answers one question: when does this component need to be interactive?

  • client:load — immediately. Use for above-the-fold UI people touch right away.
  • client:idle — once the main thread is free. Good for secondary widgets.
  • client:visible — when scrolled into view. Ideal for comments, carousels and footers.
  • client:media — only at certain breakpoints, such as a mobile-only menu.

Default to none

The best directive is often no directive at all. A surprising amount of “interactivity” — tabs, accordions, theme toggles — works with a few lines of vanilla script or plain HTML like <details>.

Trade-offs to know

Islands don’t share state automatically. When two islands need the same data, reach for a tiny store library or custom events instead of wrapping the page in one giant component.

Takeaway

Start static, add islands deliberately, and pick the laziest directive that still feels instant. Your users’ devices will thank you.

Related

Keep reading

View all posts

Performance

A field guide to Core Web Vitals

Measure what matters: practical fixes for LCP, INP and CLS that move the numbers in real user data.

Ava Thompson1 min read

Astro · Animation

View transitions without a framework

Native page transitions are here. A walkthrough of the API and how Astro makes it a one-liner.

Ava Thompson1 min read

Type to search across all articles.