Managing State in Vue with Vuex

Originally published at: Managing State in Vue with Vuex - Ionic Blog

Every app at some point will need to tackle one of the most contentious subjects in front end development: State Management. If you ask ten different developers how to manage state in an app, you’ll most likely get ten different answers, as everyone can have a slightly different approach if they were to build their…

5 Likes

Mike, thanks for this. I’ve been using NgRx in an Ionic/Angular app for the last couple of years. To be honest my thoughts yo-yo on whether I am doing things properly all the time. Sometimes I’m glad I used NgRx and sometimes I realised I OVER-USED it - I think our app is probably a classic case of where it should be used in parts of the app but maybe not all over the app.

Anyway recently I dived into Vue. One of the things I found with Vuex is that I was far more likely to re-use an Action whereas with NgRx I had tried to keep to Mike Ryan’s Good Action Hygene principles and have each Action unique. Vuex does not seen to encourage this so much (but maybe it’s because I am only just getting started and have not got into it enough yet)

1 Like

i think that this “issue/concern” is one of the reasons that tech gets overly complex… i understand what he is trying to accomplish, but all this does is get people caught up who/what is right who/what is wrong instead of adding value to the deliverable… but like him, this is just my opinion and I don’t think the state manager police are going to chase you down for not following the pattern or for reusing an action

1 Like

Yes, I agree. However, I must admit that when I’ve followed those principals with NgRx it has provided benefits (despite the extra boiler plate). Knowing exactly the source of any action has certainly helped debug issues. And in cases where I have not followed it and have duplicated actions, it has taken a bit more time to sort out.

Both points are valid here. There’s a balance of being dry/clean without over complicating things. All just personal preference and not a “one is correct and one is wrong”