Complete the code to define an Island component in Astro.
export default function [1]() { return <button>Click me</button>; }
The Island component is named IslandButton to clearly identify it as an isolated interactive part.
Complete the code to hydrate the Island component only on client side.
import IslandButton from './IslandButton.astro'; <IslandButton client:[1] />
The client:only directive tells Astro to hydrate this Island only on the client side, optimizing performance.
Fix the error in the code to prevent unnecessary JavaScript loading.
<script type="module" src="[1]"></script>
Only the JavaScript module file (.js) should be loaded for client-side interactivity, not the Astro file.
Fill both blanks to create a minimal Island that only hydrates when visible.
export default function [1]() { return <div>Interactive Island</div>; } <[2] client:[3] />
The component is named VisibleIsland and hydrated with client:visible to optimize performance by loading only when visible.
Fill all three blanks to create an Island with a button that increments a counter only on client.
import { useState } from 'react'; function [1]() { const [count, [2]] = useState(0); return <button onClick={() => [3](count + 1)}>Clicked {count} times</button>; } export default [1];
The component is named CounterIsland. The state setter setCount updates the count on button click.