DEV Community

Discussion on: You Might Not Need Vuex with Vue 3

Collapse
 
angularnodejs profile image
AngularNodeJS 🚀

It's more simple until you trip up on something and waste your time going down rabbit-holes.

Collapse
 
sonicoder profile image
Gábor Soós

Trip up on what? It's the built-in reactivity system with functions mutating the variables.

Thread Thread
 
angularnodejs profile image
AngularNodeJS 🚀

I was talking about the simple implementation of trying to replace Vuex, it's not a complete solution. Still it is a nice write up on how one would go about using a simple reactive global store.

Thread Thread
 
philippm profile image
Philipp Mildenberger

I have yet to see what real benefits Vuex or in general a Flux-based solution is providing compared to such simple solutions. In my eyes it's more flexible and less boilerplate heavy. If you need more features one can always write up logic around that specifically for the usecase (e.g. what we currently have a model manager that takes care of model instantiation, persistence etc.).
The only really thing that I currently see where vuex has advantages is vue dev tools integration.

Do you have examples where vuex shines compared to that solution?

Thread Thread
 
vitandrguid profile image
Vitor Andrade Guidorizzi

I agree with this, I'm writing a really large vue2 + vuex + ts SPA and thought that vuex would be obligatory, turns out making a really strict typed store with vuex 3 and a lot of store modules is possible but infuriating, its 10 times the boilerplate and whenever you use your store on a component vuex doesn't infer the typing due to its weird string accessor of getters, state and what not.

After fighting against the lib lack of proper TS support i decided to test some libs like vuex-class-modules, vuex-module-decorators and many others, every single one had annoying issues or lacked features.

Looking back, the only thing vuex has that is awesome is the community plugins and the devtools debugger, but i don't think its worth it, with the new composition API i don't see much reason to use it, especially since you can enforce your own accessors and practices instead of the weird soup that is vuex