Question · Vue.js course · Module 4: Computed & Watch

Cleanup in watch

How do you perform cleanup (resource disposal) in a watcher?

Answer options

  • Use the onCleanup callback in watch
  • Return a cleanup function from the callback
  • Use the global useCleanup() function
  • Watch does not support cleanup

You can check the correct answer by solving this task in the CodeWorlds game.