DEV Community

Discussion on: You should be using Vue Class Component

Collapse
 
ksnyde profile image
Ken Snyder

VueJS 3.x does not support the class component approach and while I did use to love class components, I strongly suggest people just move to Vue 3's composition API. Much better in so many ways.

Collapse
 
kennyrafael profile image
kennyrafael

Vue Class Component V8 is beta now, should be available soon with support to Composition API features. Evan You itself put his hand on this project, I would not believe they will let it go that easily.

Collapse
 
ksnyde profile image
Ken Snyder

That's interesting. I had thought retiring this functionality would not go over well and eventually the "upgrade pressure" if nothing else would force this to happen. Personally, having now gotten used to the composition API, I will not be going back to the class syntax but I do have a 2.x project which makes heavy use of the Class Components and maybe I'll look at the upgrade path based on this being available.

Collapse
 
andreigheorghiu profile image
Andrei Gheorghiu

This is misleading.
Evan You has declared multiple times that, although initially the Class API seemed to solve a number of Typescript related problems, it actually created other, more complex ones, due to inferring props from multiple sources.
Read about it in detail.
He also declared it's not on Vue's roadmap to continue support for class API, as it would be a third way, besides Options API and Composition API of doing the same thing and it adds too much overhead. In general, his intention is to reduce the maintenance surface of Vue.
This means vue-class-component maintainers are on their own, and the future of this syntax depends entirely on the future of the plugin and on how much effort the plugin maintainers are willing to put in, for maintaining compatibility with all the new additions to Vue core.

Collapse
 
lzxb profile image
狼族小狈

I like class style code, and I don't want to give it up

Use class style to write setup and support vue2 and vue3
github.com/fmfe/vue-class-setup