Performance: Why Islands architecture optimizes performance
Islands architecture improves page load speed and interaction responsiveness by reducing JavaScript and DOM work on initial load.
Use Islands architecture to render static HTML for the whole page and hydrate only small interactive islands separately as needed.
Render the entire page as a single large React or Astro component with all JavaScript bundled and hydrated at once.
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Single large hydrated app | High (deep tree) | Multiple reflows during hydration | High paint cost due to layout thrashing | [X] Bad |
| Islands architecture | Low (small islands) | Few reflows limited to islands | Lower paint cost, faster first paint | [OK] Good |
client:load to hydrate component when page loads.client:only loads component only on client, client:idle hydrates when browser is idle, client:server is invalid.<script type="module">
console.log('Page loaded');
</script>
<Counter client:load />
<script type="module">
console.log('Counter hydrated');
</script>Counter component hydrates after page load, so 'Counter hydrated' logs after hydration.<MyWidget client:load></MyWidget>
<MyWidget client:load /> is correct.Pass the test and this pattern moves unknown