Vue · Junior · Question 42 of 75
When should you use watch instead of computed?
- ✓Correct answer: When you need a side effect in response to a change, like fetching data or saving to
localStorage - 2Whenever you need a derived value
- 3They are interchangeable
Explanation
computed returns a derived value; watch runs code. watch(id, async (newId) => { data.value = await load(newId) }) is a typical use.