Challenge - 5 Problems
Astro Idle Hydration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens when using
client:idle in Astro?Consider an Astro component using
client:idle for hydration. What is the expected behavior of this component in the browser?Astro
<MyComponent client:idle />
Attempts:
2 left
💡 Hint
Think about when the browser considers itself 'idle' and how that affects hydration timing.
✗ Incorrect
The client:idle directive tells Astro to wait until the browser is idle before hydrating the component. This means the component does not hydrate immediately on page load but waits for the browser to finish higher priority tasks.
📝 Syntax
intermediate1:30remaining
Identify the correct syntax to defer hydration using
client:idle in AstroWhich of the following is the correct way to defer hydration of a component using
client:idle in Astro?Attempts:
2 left
💡 Hint
Astro uses colon syntax for hydration directives.
✗ Incorrect
The correct syntax uses a colon between client and idle without quotes or dashes.
🔧 Debug
advanced2:30remaining
Why does this component hydrate immediately despite using
client:idle?You wrote
<MyComponent client:idle /> but the component hydrates immediately on page load. What is the most likely cause?Astro
<MyComponent client:idle />
Attempts:
2 left
💡 Hint
Consider browser compatibility with idle detection APIs.
✗ Incorrect
If the browser does not support the Idle Callback API, Astro cannot defer hydration and falls back to hydrating immediately.
❓ state_output
advanced2:00remaining
How does
client:idle affect component state initialization?If a component uses
client:idle hydration, when will its client-side state initialize?Astro
<MyComponent client:idle />
Attempts:
2 left
💡 Hint
Think about when hydration triggers client-side JavaScript.
✗ Incorrect
With client:idle, the component's client-side JavaScript, including state initialization, runs only when the browser is idle and hydration occurs.
🧠 Conceptual
expert3:00remaining
Why choose
client:idle over client:load in Astro?Which is the best reason to use
client:idle instead of client:load for hydrating a component?Attempts:
2 left
💡 Hint
Consider how hydration timing affects user experience and performance.
✗ Incorrect
client:idle defers hydration until the browser is idle, reducing blocking during initial load and improving performance.