In this article, we’ll take a look at the Vue Composition API plugin for Vue 2.x to create our components in ways that are closer to the Vue 3.x way.
With it, we don’t have to worry about name clashes between mixin members and component members because all the members are encapsulated in their own function and we can import them with new names.
Also, we don’t have to recreate component instances to reuse logic from different components. The Composition API is built with large projects in mind, where there’re lots of reusable code. In addition to the benefits that are listed above, we also have better type inference.
It’s also more readable because we can trace all the code back to their composition function where the code is declared in the setup method.