top | item 17628541

Please Sell Me on Vuex

1 points| LiterallyDoge | 7 years ago | reply

I mean this post with the utmost respect for the brilliant minds that brought you Redux. Given that React is a view handler and not a full state controller, it completely makes intuitive sense.

Vuex on the other hand I'm failing to see the use case for, but I feel dirty. I'm coding without it just fine, and everything works great, but I have this nagging sense that I'm doing things wrong, reinforced by the infinite masses of trendy JS articles urging me to join The Church of Framework X.

Can some kind soul out there put into words what makes Vuex awesome and why it was worth it for you to use, given the nature of Vue being so darn good at two-way automagical bind handling?

Thanks for any input.

8 comments

order
[+] cimmanom|7 years ago|reply
Vue won’t let you pass changes in data upwards through the component hierarchy. Once you need to do that (and you need to do that in any non-trivial application), your only options are event passing (which quickly becomes awkward and difficult to reason about - as anyone who’s ever picked up someone else’s large Backbone project will attest) or a dedicated data store. It doesn’t have to be Vuex, but Vuex integrates well and is reasonably easy to work with, so why not?
[+] LiterallyDoge|7 years ago|reply
Interesting - good point! Would having a window.x variable (traditional global) also solve this?
[+] anthonygore|7 years ago|reply
Sharing data between components without parent/child relationship is the main reason