Difference in performance between ngrx and ngxs? [closed] Difference in performance between ngrx and ngxs? [closed] angular angular

Difference in performance between ngrx and ngxs? [closed]


Here is good answer from Reddit (Angular2+ community). It's from a developer who tested both and switched to NGXS.

I would like to share my experience. We have a medium-large enterprise app. We started with NGRX, but it quickly became clear that

NGRX code is much difficult to understand and write to teammates.

NGRX is boilerplate hell. You spend lot of time with it.

The concept of "Effects" is good, but it just adds extra layers of complexity which could be simplified.

Developer Experience (DX) was horrifying.

Then we switched to NGXS.

It has minimum boilerplate. You jump right into "action" :D.

We were delighted by its DX.

It is much easier to understand for teammates and everybody was suddenly productive.

There are some tradeoffs like server calls are in reducers, but it made sense to use after a while.

PLUGINS! There are loads of plugins from logging to forms handling (Awesome thing ever).


From what I'm experiencing, NGXS is way simpler to write and it's easier to work with lazy loaded states. It has such a simple syntax, it's OOP, instead of Redux FP paradigm. Decorate your actions and selectors, subscribe to memoized states, catch dispatched actions anywhere, etc.

However, I found a pitfall when it comes to the storage plugin which is essentially for offline first applications. It uses sync local storage which has a limit of 5MB and will stall the UI when it needs to write big data to storage. However you could write a custom storage solution on top of the plugin. It's scalable, extensible, you can inject the util classes in a breeze, the documentation is as simple as it can be.


I recently had a problem with NGRX, since I had to dispatch two actions, but the second depended on the success of the first, the problem was that the Reducers run asynchronously, and the second action ended without the first one having finished, try to solve it with an Effects , but even there the same thing happened. With NGXS I could solve it since the Dispacher returns an observable at the end of the action.

In general NGXS has worked very well, and the performance is very similar, I had to update a lot of data in an architecture with several nested levels, and there does not seem to be a difference in the update time.