0
0
Astroframework~20 mins

client:idle for deferred hydration in Astro - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Astro Idle Hydration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2: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 />
AThe component hydrates immediately as soon as the page loads.
BThe component hydrates only when the browser is idle, after initial page load.
CThe component hydrates only when the user clicks on it.
DThe component never hydrates and remains static.
Attempts:
2 left
💡 Hint
Think about when the browser considers itself 'idle' and how that affects hydration timing.
📝 Syntax
intermediate
1:30remaining
Identify the correct syntax to defer hydration using client:idle in Astro
Which of the following is the correct way to defer hydration of a component using client:idle in Astro?
A<MyComponent client:idle />
B<MyComponent client-idle />
C<MyComponent client:idle='true' />
D<MyComponent clientIdle />
Attempts:
2 left
💡 Hint
Astro uses colon syntax for hydration directives.
🔧 Debug
advanced
2: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 />
AYou forgot to import the component, so hydration fails silently.
BThe <code>client:idle</code> directive only works on server components.
CThe component has no interactive code, so Astro hydrates it immediately.
DThe browser does not support the Idle Callback API, so hydration falls back to immediate.
Attempts:
2 left
💡 Hint
Consider browser compatibility with idle detection APIs.
state_output
advanced
2: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 />
AState never initializes because hydration is deferred.
BState initializes on first user interaction.
CState initializes only after the browser becomes idle and hydration runs.
DState initializes immediately on server render and is reused on client.
Attempts:
2 left
💡 Hint
Think about when hydration triggers client-side JavaScript.
🧠 Conceptual
expert
3: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?
A<code>client:idle</code> improves initial page load performance by deferring hydration until the browser is idle.
B<code>client:idle</code> guarantees hydration before any user interaction.
C<code>client:idle</code> hydrates components only on mobile devices.
D<code>client:idle</code> disables hydration entirely to save resources.
Attempts:
2 left
💡 Hint
Consider how hydration timing affects user experience and performance.