Custom directives in Vuejs 3 are one of those things where there is no compatibility with the previous version of the framework. Before entering the implementation of a custom tooltip directive in Vuejs 3 let me introduce the fundamentals of a good code reuse strategy in Vuejs. The most important forms for code reuse in Vuejs are https://vuejs.org/guide/essentials/component-basics.html and https://vuejs.org/guide/reusability/composables.html if you write components with composition API.
Vuejs provides other options for code reuse, such as mixins, directives, and plugins, which can further improve your code’s maintainability and reusability.