0
0
Vueframework~10 mins

Why deep reactivity understanding matters in Vue - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a reactive object in Vue.

Vue
const state = reactive({ count: [1] })
Drag options to blanks, or click blank then click option'
A0
Bnull
Cundefined
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using null or undefined as initial count causes unexpected behavior.
2fill in blank
medium

Complete the code to watch a reactive property in Vue.

Vue
watch(() => state.count, (newVal, oldVal) => { console.log([1]) })
Drag options to blanks, or click blank then click option'
AoldVal
Bstate.count
CnewVal
Dundefined
Attempts:
3 left
💡 Hint
Common Mistakes
Logging oldVal shows the previous value, not the current one.
3fill in blank
hard

Fix the error in the code to update a nested reactive property correctly.

Vue
state.user.name = [1]
Drag options to blanks, or click blank then click option'
AAlice
B'Alice'
Cnull
Dundefined
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around string literals causes runtime errors.
4fill in blank
hard

Fill both blanks to create a computed property that doubles a reactive count.

Vue
const doubleCount = computed(() => state.count [1] 2 [2] 0 )
Drag options to blanks, or click blank then click option'
A*
B+
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using + instead of * changes the meaning.
5fill in blank
hard

Fill all three blanks to create a reactive object with a nested reactive array and update it.

Vue
const state = reactive({ items: [1] }) 
state.items.push([2]) 
console.log(state.items[[3]])
Drag options to blanks, or click blank then click option'
A[]
B'new item'
C0
D{}
Attempts:
3 left
💡 Hint
Common Mistakes
Using {} instead of [] for array initialization causes errors.