Question · Vue.js course · Module 14: Directives & Plugins

Cleanup in directives

Why should event listeners be removed in the unmounted hook?

Answer options

  • To speed up rendering
  • So Vue can use the virtual DOM
  • So the directive can be reused
  • To avoid memory leaks

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