Overview - client:idle for deferred hydration
What is it?
In Astro, client:idle is a directive that delays the activation of interactive JavaScript on a component until the browser is idle. This means the component is rendered as static HTML first, and its JavaScript only loads and runs when the user’s device is not busy. It helps improve page load speed and user experience by deferring non-essential scripts.
Why it matters
Without client:idle, all interactive components load their JavaScript immediately, which can slow down page loading and make the site feel sluggish. By deferring hydration until idle time, websites become faster and more responsive, especially on slower devices or networks. This improves user satisfaction and can boost SEO and engagement.
Where it fits
Before learning client:idle, you should understand basic Astro components and hydration concepts like client:load and client:visible. After mastering client:idle, you can explore other hydration strategies and performance optimization techniques in Astro and modern web frameworks.