Challenge - 5 Problems
Vue Performance Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
How does Vue's reactivity system affect component updates?
Consider a Vue 3 component using the Composition API with a reactive state. What happens when a reactive property changes?
Vue
<script setup> import { reactive } from 'vue' const state = reactive({ count: 0 }) function increment() { state.count++ } </script> <template> <button @click="increment">Count: {{ state.count }}</button> </template>
Attempts:
2 left
💡 Hint
Think about how Vue tracks dependencies to update only what is necessary.
✗ Incorrect
Vue's reactivity system tracks which parts of the template depend on reactive properties. When 'state.count' changes, only those parts re-render, improving performance.
❓ state_output
intermediate2:00remaining
What is the output when updating a reactive object in Vue?
Given the following Vue 3 setup, what will be displayed after clicking the button twice?
Vue
<script setup> import { reactive } from 'vue' const state = reactive({ items: [] }) function addItem() { state.items.push('item') } </script> <template> <button @click="addItem">Add</button> <p>Items count: {{ state.items.length }}</p> </template>
Attempts:
2 left
💡 Hint
Remember how Vue tracks changes in reactive arrays.
✗ Incorrect
Vue tracks mutations on reactive arrays like push. After clicking twice, two items are added, so the count is 2.
📝 Syntax
advanced2:00remaining
Which option correctly uses Vue's