Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Vue.js 3 Custom Directives

The Directive’s unMounted Hook thumbnail image

Get access to the most comprehensive Vue.js video library in the world. Over 300 video lessons including the newest Vue 3 features.

The Directive’s unMounted Hook

In this lesson, we learn about a common gotcha when using custom directives together with intervals and events. The key to avoiding such bugs is using the unmounted hook to clear the interval or detach the event listener.