Vue · Junior · Question 19 of 75

Can you assign a new array to a ref holding a list?

const items = ref([]);
items.value = await fetchItems();

Explanation

Vue 3's Proxy-based reactivity tracks both replacing the value and mutating arrays (push, splice, index assignment). This was a known limitation in Vue 2 that is gone now.

Further reading

Problem with a question

Vue · Junior · question 19

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz