top | item 42334190

(no title)

STRiDEX | 1 year ago

I used vue 2 for work during the switch to vue 3. It was horrific to watch as the vue community had to relearn the worst parts of the class components and the massive shortcomings of both the template library type checking and the other parts that basically can't ever support typescript like class mixins. If you want to use vue with a .tsx file you might as well use react.

Today, 33% of vue downloads in the last 7 days are for vue 2.

There was a lot of things that were nice in the vue world like vite and vuex, but I'd never recommend vue to anyone, especially anyone that wants a good typescript experience.

here's an example library button using .tsx in vue https://github.com/vuetifyjs/vuetify/blob/master/packages/vu...

discuss

order

sensanaty|1 year ago

I feel like your experience is a bit jaded by the 2 -> 3 transition which is understandable because it wasn't the smoothest, but these days things are very stable, and you can even use the CompositionAPI in Vue 2.7 as it's been backported if you can't upgrade from 2 -> 3. Typescript support is also great because composables are just regular JS/TS files now rather than a Vue-specific thing, the only part that is a bit wonky is in templates sometimes, though for the majority of code out there even template type checking works just as you'd expect, I very rarely have issues even with huge components.

Pinia is Vuex, it was made by the same people specifically for Vue 3 due to otherwise having to introduce a lot of breaking changes and is a lot simpler than VueX was, as it leverages the composable pattern and gets rid of the need to do things like `mapGetters`/`mapActions`. And VueX 4 is still an option for those that prefer that approach.

> ... class mixins

Those were a pain point, but no longer relevant in Vue 3 as mixins have been deprecated. Again, composition takes its place and is in general much more powerful while being simpler. For a great example of what composables can achieve, I'd recommend taking a look at VueUse (https://vueuse.org/)

> Today, 33% of vue downloads in the last 7 days are for vue 2.

Another way to look at that is that the majority of the community is on Vue 3 :)

> If you want to use vue with a .tsx file you might as well use react.

`.tsx` is very much a personal preference thing and isn't really considered idiomatic despite Vue having support for it (unless you're a library author like Vuetify that you linked). I personally can't stand working with `jsx` and find Vue SFC's superior, and again, typechecking these days is much better than it ever was and will work just fine in 95% of situations. Especially with things like component generics being introduced, it's only gotten better and actively getting better.

I'd highly recommend you give Vue 3 a try with an open mind, because things have only gotten more powerful while getting simpler since the Vue 2 days.