Discuss the differences and use cases for the watch, computed, and methods properties in Vue.js.
Instruction: Compare and contrast the watch, computed, and methods properties in Vue.js, including specific use cases for each.
Context: This question aims to assess the candidate's depth of understanding regarding Vue.js reactivity and data handling by differentiating among these three essential properties and identifying appropriate scenarios for their use.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Use computed for a synchronous derived value, watch for a side effect tied to a reactive source, and methods for work explicitly invoked by an event or caller. Both Options API and Composition API can express these roles.
A computed result is cached according to the reactive dependencies read by its getter. Keep that getter pure: deriving a filtered display list fits; issuing a request or modifying its own source does not...