DEV Community

loading...

What state management you use?

Julio Rodrigues
I'm Brazilian Developper. Hello :)
・1 min read
Hey everyone! I'm search about state management lib, and i need to know what you use in your projects.

Discussion (12)

Collapse
layzee profile image
Lars Gyrup Brink Nielsen

RxJS, but it takes a lot of effort to learn it.

Collapse
foresthoffman profile image
Forest Hoffman

Are there any good guides/videos/books that you've found helpful while learning RxJS?

Collapse
layzee profile image
Lars Gyrup Brink Nielsen • Edited

I am currently going through the book Mastering Reactive JavaScript by Erich de Souza Oliveira. It is really good at teaching the basics of Reactive Programming and introducing different types of observables. It starts out with Bacon.js and then moves on to explain how to use RxJS 4.

packtpub.com/web-development/maste...

RxJS has gotten major changes in versions 5 and 6. Many operators have changed their names and operators are now composed with the pipe method on observables.

Despite working with a really outdated version of RxJS, it is a good read for JavaScript developers who wish to learn Reactive Programming with the Observer Pattern.

For more advanced, in depth articles, find Ben Lesh and Angular In Depth on Medium.

medium.com/@benlesh

blog.angularindepth.com/tagged/rxjs

Collapse
nestedsoftware profile image
Nested Software

In React, I think you can get away with a combination of using the new context api along with component composition. Redux seems to be a bit of a de facto standard for react apps, but can easily get a bit complicated, so you may not need it.

Collapse
vatdaell profile image
Ansaf Ahmad

We've been using mobx at work and so far we have no complaints

Collapse
d0ruk profile image
Doruk Kutlu • Edited

+1 for mobx - it is considerably faster to come up with a state management solution. The lib is really intuitive, and is closer to JS (in its constructs) than rx.

Things get a bit messy when the number of your stores increases, but then you have mobx-state-tree. It is the correct way of wielding mobx in a complicated state tree. That is, when you bashed your head against the keyboard enough times and understand how it works.

Here is something I did in 15 minutes. Doing those simple things even with the new Context API would take longer.

Collapse
vatdaell profile image
Ansaf Ahmad

You are right about the messiness on larger projects. If you plan out how your state will be managed, you can avoid the messiness but I do agree that it's easier to mess up than to build it right the first time.

Collapse
inizio profile image
IniZio • Edited

I made a library for state management github.com/IniZio/reim, it is still new and stuff, but it has high test coverage :)

Basically create a store and then the only thing you care is setState to update the store. No ALL_CAPS_ACTION_TYPES just functions as mutation. You can also use Rxjs with it and it is very extendable with plugins like reim-reporter.

It can also be used with Vue, instead of setState you use commit to make changes.

Collapse
xngwng profile image
Xing Wang

What is what you are trying to build?

Backend? frontend? Data processing? UI? mobile? Browser?
Have you picked the langauge/framework/tools?

I think there are too many things to figure out first (or let people you are asking know) before picking the right answer.

Collapse
juulhao profile image
Julio Rodrigues Author

I'm Just searching for the most used State management by the community. i have been used Mobx, Redux, Vuex (for Vue). Thank's for your opinion!

Collapse
thomasjunkos profile image
Thomas Junkツ

As I am developing Vue, I am using Vuex. Otherwise I would go for MobX under react or RxJS

Collapse
enishowk profile image
Enishowk

I have switch to Mobx, from Redux.