Member-only story
Reasons To Switch From Vue2 to Vue3
As many of you already know, VueJs has two main versions: Vue2 and Vue3. It took me a long time to switch to the latest version and here is why I regret not doing it earlier.
Composition API
Well, obviously this is one of the features that completely changed the view of Vue3 and its implementation.
It just made the structure better and easier to maintain. That means that instead of having dedicated objects for data, methods, and so on, you can structure your code by modules and I think it is amazing.
Just take a look at the example and the difference in code between Options API (Vue2) and Composition API (Vue3).
Single root element
It is maybe not the most important feature that you can have in the application but it can make the structure of the code way cleaner by avoiding unnecessary “divs” or “templates” around our HTML elements.
So, instead of typing this:
<template>
<div>
<h1> Title here </h1>
<p> Text here </p>
</div>
</template>