new to astro — do people really give every interactive bit its own island Islands
Coming from Next. Building a marketing site plus a small dashboard section in Astro 5.
I've got a nav with a mobile menu, a theme toggle, a newsletter form, a pricing calculator and an FAQ accordion. Right now each is a separate .svelte file with client:load on it, so the page mounts five separate components with five separate roots.
That feels wrong? In Next it'd be one tree. Is this genuinely how people build these, or have I misunderstood the model?
@tomato_tobin · 6mo ago · 3 replies
That is how it works, yes. But you've got the directives wrong and that's where the cost actually is.
Five islands is fine — they're independent little apps and that's the point. Five
client:loadis not fine, because it hydrates everything before anyone interacts with anything.client:media="(max-width: 768px)"— desktop never downloads itclient:visible, it's in the footer<details>and<summary>, zero JSclient:idleorclient:visibledepending on where it sitsYou'll go from around 140 KB of JS to under 30 and the page will feel identical.
Reply
Report
@mulch_mule · 6mo ago
The FAQ one is embarrassing. I have an entire Svelte component doing what
<details>does natively.Reply
Report
@drainfield_dez · 6mo ago
Everyone does that once. The Astro reflex is 'can the platform already do this', and the answer is yes far more often than a React habit expects.
Reply
Report