DEV Community

Discussion on: Do we really need Flux, Vuex, Pinia, MobX and all the other Statemanagement Frameworks?

Collapse
 
webbureaucrat profile image
webbureaucrat

The argument to use them get killed with the next one coming up from nowhere.

Wow I don't think that's how that works at all. The next one isn't there to necessarily replace the last one--it's usually there to serve a slightly different need or use case. Like if I were trying to write JS, I would probably gravitate toward Redux because Redux is based off of the Elm language's state management and I'm an Elm dev, but there are lots of other good reasons to use other tools I wouldn't use.

So why use them at all? Because state management is really difficult in a large codebase.

It's not at all uncommon to share state between components. Take any page that might look different depending on whether the user is authenticated or not. The whole page might look completely different, and every part of the system has to know who is logged in and what to display and request on their behalf. That's a very common use case.

It's all good to say "less is more" but if you're doing nontrivial work on the DOM I really think you need good state management design patterns at least, and at that point you're looking at writing your own libs, so you may as well not reinvent the wheel.

Collapse
 
decker67 profile image
decker

I do not want to write my one, but simply use that what is already given in the frontend framework instead of adding another player to the game.

In SolidJS you have Stores in VueJS you have reacitve (V3) or observable (V2) so why using another thing, that makes it more difficult to understand.

The authors auf Pinia, the new kid on the block for VUE, notices themselfes that you already have a statemanagement in VueJS.

Another thing is I often see code that simply uses state management for every little thing, but there is only one position in the code where the state is used. So no need to have statemanagement. It is simply not shared.

It seems to me that many developers do things simply because the have seen somebody else done it in a sample or tutorial. Its this the next step from copying code from stackoverflow to do the work that has to be done?