DEV Community

Florin Cosmin
Florin Cosmin

Posted on

ngrx or angular-redux/store ?

Hello everyone. I'm familiar with redux and react-redux bindings but recenlty switched jobs and I have to work with angular. We currently have an inhouse integration/wrapper with redux but it's a one man show code, not so easy to understand and I'm missing documentation. So I want to propose we switch to one of the above. Do you have experience with any of these libraries? What is your experience so far?

Top comments (5)

Collapse
 
alessandrojcm profile image
Alessandro Cuppari

I've worked with NGRX and, although is great (it's like magic when you set it all up), the boilerplate that you have to write in order to set a simple slice for the store is just annoying; literally, you have to write the state, selectors, reducers, effects, etc, etc. Of course, that if you use the full NGRX/platform; but still, it's quite some boilerplate.

I'll recommend you take a look to Akita which is a state management tool made by the folks at Datorama. I haven't use it (yet, I'm planning to use it on a project that is in the design stage) but their aim is to reduce the amount of boilerplate; plus, is great for people with OOP background (like myself) and they have a nice amount of funcionality built in for Angular (like pagination and form state).

Hope that helped!

Collapse
 
bboydflo profile image
Florin Cosmin

Thanks a lot! I've read about Akita just yesterday. Will look more into it.

Collapse
 
eomusoru profile image
Ed

When we are talking about state management I really think it's very important to realize what your app should do, how much business logic you should add on it.

For example, if you have a very complex flow and you always rely on some pieces of information from observables, for sure you need Effects. Effects are from ngrx and not in simple state management patterns (like Akita, Flux or any one of them).

If you just need to keep the state and everything it's pretty straight forward, simple subjects with observables are probably the best choice.

Collapse
 
joanllenas profile image
Joan Llenas Masó

If you are in the process of investigating alternatives there's also github.com/ngxs/store

Personally, I think that ngrx does a great job at mimicking Redux on the Angular ecosystem. All Redu best practices and patterns are applicable to ngrx so, you won't have to learn much.
Also, the library is very well maintained, has decent docs, and there are tons of 3rd party learning resources.

Regarding the boilerplate Alessandro Cuppari mentioned it's true (just like with Redux), but things are improving in this next release. Take a look at: medium.com/@gregor.woiwode/ngrx-8-...

Good luck!

Collapse
 
eomusoru profile image
Ed

So I really can not see a very straight difference between these two libraries.

One is basically in the angular ecosystem way and the other one is built to support the Redux implementation. I would probably go with the ngrx, mostly because it's in an angular way.