Navigating Islands of Interactivity

This ad is not shown to multipass and full ticket holders
JS Nation
JSNation 2026
June 11 - 15, 2026
Amsterdam & Online
The main JavaScript conference of the year
Learn More
In partnership with Focus Reactive
Upcoming event
JSNation 2026
JSNation 2026
June 11 - 15, 2026. Amsterdam & Online
Learn more
Bookmark
Rate this content

Astro islands are a powerful primitive that allow you to take your statically rendered content, and gradually add interactive components as you go. Discover what client directives can do, when to use them, and how to communicate state between your islands effectively.

This talk has been presented at React Advanced 2025, check out the latest edition of this React Conference.

FAQ

An island is an interactive JavaScript component that is hydrated separately from the rest of the page. It involves sending static HTML from the server to the client and progressively loading JavaScript needed for interactive elements.

The term 'island architecture' was coined by Jason Miller, the creator of Preact, in 2021.

Frameworks like Astro, Fresh, and prior versions of Marko and Quig have adopted island architecture. There have also been demos in Eleventy and Preact.

Islands reduce the amount of JavaScript needed, leading to smaller pages and faster load times. They load components in parallel and provide fine-grain control over the JavaScript shipped to users.

In Astro, client directives are used to load components in different ways, such as client:load, client:idle, client:visible, client:media, and client:only. These directives control when and how components are hydrated.

Nanostores is a tiny state manager that allows sharing of state across different islands and frameworks. It has zero dependencies and can be used with various JavaScript frameworks.

Island architecture is useful for eCommerce sites, media sites, documentation, blogs, and dashboards where most of the page is static, and only certain components require interactivity.

Yes, islands can share state using state management libraries like Nanostores, which can be integrated with various frameworks to manage shared state.

Key takeaways include thinking static first, adding interactivity as needed, using client directives for control, and sharing state between islands easily with stores like Nanostores.

Client directives in Astro, such as client:load, client:idle, client:visible, client:media, and client:only, control when and how components are hydrated on the client side.

Reuben Tier
Reuben Tier
9 min
01 Dec, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Islands in web development are interactive components that are rendered on the server and hydrated separately. They offer fine-grain control over JavaScript, speed up page loading, and reduce JavaScript shipping. Applications of islands span across eCommerce, media sites, docs, and blogs, providing interactivity without excessive JavaScript. Nanostores enable state sharing among islands. Key takeaways include utilizing Nanostores for state management, exploring ASTRO and islands for development, and using client directives for JavaScript control.

1. Understanding Island Architecture

Short description:

Islands are interactive JavaScript components hydrated separately from the rest of the page. Island architecture, coined by Jason Miller, involves rendering HTML on the server and hydrating interactive components on the page. Frameworks like Astro and Fresh heavily integrate islands. Using islands in Fresh is straightforward by placing components in an islands folder. In Astro, client directives like client load, idle, visible, media, and only control component loading strategies.

So, what is an island? Interactive JavaScript component that is hydrated separately from the rest of your page. You send static HTML from your server to the client and then progressively load the JavaScript you need for the interactive elements of your page. It looks a little something like this.

So you have your static page here. Your header may have interactive components, maybe a search bar, maybe a shopping widget. Your image carousel will have interactive JavaScript components, but the rest of the page is just completely static HTML and doesn't need to be loaded.

So where does island architecture come from? Well, island architecture was originally coined by Jason Miller, the creator of Preact, back in 2021. However, the concept goes back further and he has credited KT Sillnull-Miller with coining component islands, which is this similar idea where you render HTML on the server, then hydrate those interactive components on the page rather than hydrating the entire page with JavaScript. Islands have been adopted by a few different frameworks, Astro, prior versions of Marko, Fresh, and Quig. There have also been demos in Eleventy and in Preact.

So how do you use islands? Well, I'm going to show you how to use them specifically in Astro and Fresh, two frameworks that have integrated islands very heavily. But there are fantastic examples out there on implementing them individually in your own framework. In Fresh, it's very simple. All you need to do is place your component in an islands folder and import that island wherever you need to use it. In Astro, it's a little more complicated. You can use client directives on those framework components to load them in different ways. So in this example, we are importing payment model, which is a React component in our Astro file. We're using it down here and we add the client load component. The client load component will render the HTML on the server, ship it to the client, and then hydrate the component on the page. This is normally the way in which islands work. There are a few others. So in Astro, we have several different client directives. Client load is the usual one that you'll be using where you render the element immediately on page load. Client idle will wait until the page has loaded. And then when the page is idle, will load your component. Client visible will hydrate the page when it enters the viewport. A form for the component, which has an interactive element, any visitor that does not scroll down to that component will not receive that JavaScript. Client media, so if you have an element that maybe only is visible on mobile, maybe a certain type of navigation, then you can avoid loading it on larger screens. Client only is a little special. It only hydrates on the client.

2. Benefits and Applications of Islands

Short description:

Using islands reduces JavaScript shipping, speeds up page loading, and offers fine-grain control over JavaScript. Islands benefit smaller pages, load components in parallel, and optimize JavaScript delivery. Applications in eCommerce, media sites, docs, and blogs provide varied uses for islands, enhancing interactivity without excessive JavaScript. Nanostores facilitate state sharing among islands across different frameworks.

So rather than pre-rendering the HTML on the server, it will only send the JavaScript to the client. This can cause some issues with layout shift and things like that. But it can also be very helpful if you don't want to render any of those components on the page. And you can create your own directives. A great one as an example was rainy in New York, where your client component would only load if it was raining in New York. But you can define a small component, which will allow you to define whatever behavior you want. That could be whether you're waiting for a button press or you are calling some API to find out if some event is happening.

So what are the benefits of islands? Well, smaller pages. You don't need to ship the JavaScript where you don't need it, and you don't need to ship as much of it. And with that, you get faster LCP. You're not waiting for your entire component, your entire page to load JavaScript and run that JavaScript for the entire page. JavaScript is the heaviest form of content that you can ship to a page. So the less of it, the better. It also loads components in parallel. If you have three, four different islands on a page, these will load in parallel. You don't have to wait for one to finish before you load the next. And finally it gives you fine grain control over the JavaScript that you ship to your users.

So when should you use islands? Well, there's a few different places. In eCommerce, you can use it for product models, cards, recommendation widgets, any kind of interactive element on the page. But given that most of your page is going to be static, doesn't have any kind of API, it's not going to be a good idea to use islands. Media sites, you can use this to load video players, comments, modals, forms, anything that you might need. Docs and blogs, code playgrounds, interactive charts, any kind of small components that require some JavaScript but don't mean you want to render the entire page in JavaScript. Even if you do, you can use this in dashboards for small amounts of hydration with charts and filters, or even to load your entire app. But how do we share a state between all of these different islands? Islands, especially in Astro, can be from different frameworks and have no built-in way of sharing state. One of my favorite ways to do that is using a library called Nanostores. Nanostores is a tiny, tiny state manager which allows you to share state across pretty much anything. It has zero dependencies and has integrations for preact, react, Vue, Svelte, Angular. You can use it in a normal script tag. Quick example of Nanostores, we import our atom here.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

You Don’t Know How to SSR
DevOps.js Conf 2024DevOps.js Conf 2024
23 min
You Don’t Know How to SSR
Top Content
The Talk covers the speaker's personal journey into server-side rendering (SSR) and the evolution of web development frameworks. It explores the use of jQuery for animations in SSR, the challenges faced in integrating React with Umbraco, and the creation of a custom SSR framework. The Talk also discusses the benefits of Next.js and the use of serverless artifacts for deployment. Finally, it highlights the features of Astro, including its function per route capability.
Opt in Design – The New Era of React Frameworks
React Advanced 2023React Advanced 2023
23 min
Opt in Design – The New Era of React Frameworks
Watch video: Opt in Design – The New Era of React Frameworks
This Talk discusses opt-in design in web development, focusing on API design and understanding good defaults. Opt-in design allows developers to start with minimal tools and gradually add complexity as needed. The principles of opt-in design include finding the lowest common denominator, making complexity easy to add, and prioritizing the user experience. The Talk also explores the concept of opt-in design in React and Astro, as well as the comparison between React and Solid frameworks. Server rendering and streaming in React are highlighted, along with the importance of suspense boundaries for a better user experience.
All Things Astro
React Day Berlin 2023React Day Berlin 2023
28 min
All Things Astro
Watch video: All Things Astro
Astro is a powerful framework for content-driven websites, with its own syntax and the ability to use favorite front-end libraries. It has seen significant improvements in Astro 2 and Astro 3, including view transitions and improved performance. Astro 4 introduces features like a powerful dev toolbar, content caching, and internationalization support. The Astro community is highly regarded, and Astro is being used for production websites. Astro also supports migrating legacy websites and integrating with headless CMSs.
Astro & Fresh - Understanding the Islands Architecture
React Advanced 2022React Advanced 2022
21 min
Astro & Fresh - Understanding the Islands Architecture
The islands architecture is a new way to build websites with low or no JavaScript, using libraries like Astro and Fresh. Server-side rendering improves SEO and loading times, but can still result in large JavaScript payloads. Hydration allows for islands of interactivity, loading only necessary JavaScript. Astro is a framework for implementing the islands architecture, supporting multiple libraries like React and SolidJS. It enables progressive migration between frameworks and integration of different libraries in the same project.
The Next Wave of Web Frameworks is BYOJS
JSNation 2022JSNation 2022
23 min
The Next Wave of Web Frameworks is BYOJS
The next wave of web frameworks is BYOJS, covering the history and evolution of building web applications. The evolution of web frameworks and build systems includes popular choices like React, Angular, and Vue, as well as advanced build systems like Webpack and Rollup. The rise of performance measurement tools and the adoption of the Jamstack have led to improved web performance. The Jamstack architecture focuses on pre-rendering pages, decoupling APIs and services, and enhancing pages with JavaScript. Astro, a static site generator with SSR support, promotes the islands architecture and partial hydration.
What's New in Astro
JSNation 2024JSNation 2024
29 min
What's New in Astro
Astro is a web framework that aims to optimize site performance without sacrificing functionality. It introduces features such as content collections and view transitions to enhance the user experience. Astro focuses on pushing the web forward by providing browser compatibility and app-like experiences. It also explores a powerful content layer and island architecture for personalized content. Astro is recommended for content-driven websites and offers a polyfill for Safari and integration with Storyblok CMS.

Workshops on related topic

Crash course into Astro and Storyblok
React Day Berlin 2023React Day Berlin 2023
119 min
Crash course into Astro and Storyblok
WorkshopFree
Arisa Fukuzaki
Arisa Fukuzaki
Headless architecture has gained immense popularity in recent years for its ability to decouple the frontend and backend, empowering developers to create engaging, interactive, and scalable web applications. 
In this workshop, we will quickly take a dive into the Headless World and Architecture. 
Additionally, we will build a blog website super quickly using Storyblok, a headless CMS that offers a real-time preview feature with nestable component approach, and Astro (3.0) which is already creating a buzz with the new app directory. 
- Master headless CMS fundamentals- Master an Astro & headless CMS approach- Use Atomic design in your Astro & Storyblok application- Creating pages, adding content and understanding how the dynamic routing works with headless
Crash Course Into Astro, Kontent.ai and Portable Text
React Summit 2023React Summit 2023
91 min
Crash Course Into Astro, Kontent.ai and Portable Text
WorkshopFree
Ondrej Polesny
Ondrej Polesny
During this crash course, we’ll create a new project in the headless CMS, create the content model and data using the Kontent.ai CLI. Then, we’ll use the content to build an Astro website including front-end components and rich text resolution using Portable Text.
This will be hands-on workshop, you’ll need VS Code, Git, NPM and basic knowledge of JavaScript. Don’t worry, I will explain all the steps as we advance through the workshop and you will be able to directly ask any questions.
Astro: All Hands On
React Day Berlin 2024React Day Berlin 2024
126 min
Astro: All Hands On
Workshop
Elian Van Cutsem
Elian Van Cutsem
Mentorship available
The web is capable of way more than we might think. During this workshop, we'll explore some lesser known parts of the web. Did you know you can control the web via webHID or send and receive notes to devices via webMIDI? In this interactive talk we might make some music together, by controlling synthesisers and exploring the wide range of strange web API's. All that in vanilla JavaScript, no frameworks needed.