Vue · Junior · Question 42 of 75

When should you use watch instead of computed?

Explanation

computed returns a derived value; watch runs code. watch(id, async (newId) => { data.value = await load(newId) }) is a typical use.

Further reading

Problem with a question

Vue · Junior · question 42

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