---
// Astro component - this part runs at build time, never in the browser
const posts = await fetchPosts();
---
<Layout>
  {posts.map(post => <PostCard post={post} />)}
  <SearchBox client:load />
</Layout>

client:load is the whole idea

Every component in an Astro page ships as static HTML by default. Only a component explicitly marked with a client:* directive - like <SearchBox client:load /> above - gets its JavaScript sent to the browser and hydrated into something interactive. Everything else stays inert, fast HTML.

Framework-agnostic islands

Astro doesn't force one component framework - a React search box, a Vue comment widget, and a Svelte filter can all live as separate "islands" on the same page, each hydrated independently.

Where it's been the right call

Content-heavy sites with a handful of genuinely interactive widgets - a blog with a search box, a documentation site with a code playground - get near-static-site load times without giving up the interactive pieces that actually need JavaScript.

Zero JS by default, opt-in where it's earned

Most frameworks ship a full JavaScript runtime to every visitor whether the page needs interactivity or not. Astro flips that default: components render to static HTML at build time, and you explicitly mark the ones that need to hydrate on the client with a directive.

<Counter client:load />
<Comments client:visible />
<Chart client:idle />

Each directive controls exactly when hydration happens - immediately, when scrolled into view, or when the browser is idle - which turns "how much JavaScript does this page ship" from an accident of framework choice into a deliberate, per-component decision.

Where islands architecture pays off

Content sites with a handful of interactive widgets - a comment section, a newsletter form, a pricing calculator - are the sweet spot. A full single-page app framework is solving a problem that mostly-static content doesn't have, and the Lighthouse scores on an Astro rebuild of a marketing site routinely embarrass the React version it replaced.