Challenge - 5 Problems
Vue in Astro Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
How does a Vue component behave inside Astro?
You include a Vue component in an Astro page using
<Component />. What happens when you load the page in the browser?Astro
<script setup> import MyVue from '../components/MyVue.vue'; </script> <MyVue />
Attempts:
2 left
💡 Hint
Think about how Astro handles frameworks for interactivity.
✗ Incorrect
Astro renders Vue components on the server first, then hydrates them on the client so they become interactive.
📝 Syntax
intermediate1:30remaining
Correct way to import a Vue component in Astro
Which import statement correctly imports a Vue component named
Button.vue in an Astro file?Attempts:
2 left
💡 Hint
Vue components use default exports and .vue extension.
✗ Incorrect
Vue components are default exports from .vue files, so import with default import and correct path.
🔧 Debug
advanced2:30remaining
Why does this Vue component not hydrate in Astro?
You have this Astro code:
But the counter does not respond to clicks in the browser. What is missing?
Astro
<script setup> import Counter from '../components/Counter.vue'; </script> <Counter />
Attempts:
2 left
💡 Hint
Astro requires client directives to hydrate interactive components.
✗ Incorrect
Astro renders components server-side by default. To make Vue components interactive, you must add a client directive like
client:load.❓ state_output
advanced2:00remaining
What is the output after clicking the button twice?
Given this Vue component used in Astro:
What will the button text show after clicking it twice in the browser?
Attempts:
2 left
💡 Hint
Vue's ref tracks reactive state changes.
✗ Incorrect
The count starts at 0 and increments by 1 on each click, so after two clicks it is 2.
🧠 Conceptual
expert3:00remaining
How does Astro optimize Vue components for performance?
Astro uses partial hydration for Vue components. What does this mean?
Attempts:
2 left
💡 Hint
Think about how Astro reduces JavaScript sent to the browser.
✗ Incorrect
Partial hydration means Astro sends static HTML first and hydrates interactive parts only when needed, improving load speed.