Vue TutorialLesson 16Free preview
Vue Watchers
This lesson is part of Vue · All levels
Summary
Watches are used to react to changes in the value of reactive data and to perform additional actions such as network requests or logging. Unlike computed values, watches run side effects when a data source changes. Vue provides the option to watch on the Options API as well as the API to watch and watchEffect on the Composition API.
Key points
- Watcher runs side effects when a reactive data changes.
- The watch option is available in the Options API; the Composition API uses watch() and watchEffect().
- The watcher may be given the deep option to monitor the deep changes of the object.
- The immediate option runs the watch once the components are ready.
- WatchEffect runs automatic effects on all the detected dependencies.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.