loading...
Cover image for 11 Reasons Why You Should Use NGXS as State Management in Your Angular Apps

11 Reasons Why You Should Use NGXS as State Management in Your Angular Apps

kuncevic profile image Aliaksei Kuncevič Updated on ・3 min read

Developers tend to use state management solutions to solve some common problems developing modern single page applications. Building a modern web application using Angular you might not need to opt-in for a state management solution right away (it depends) but when the day comes NGXS is your best choice and here is why.

Why you should choose NGXS:

  1. Bulletproofed: NGXS was built back in Feb 2018. Since then, for many years, it has been chosen by many dev teams and companies as a state management solution for their Angular apps. Now there are 3.4+ million npm downloads to date!
  2. Backed by an awesome team: NGXS is an open source project maintained by a team of great software engineers from across the globe with a combined experience of 80+ years in software development.
  3. Angular way: NGXS written by Angular devs and for Angular devs. As a result, your store-related code uses a more familiar Angular approach that leverages dependency injection, decorators, etc.
  4. Great Features: There are many awesome features that NGXS offers: component communication, state operators, selectors and much more.
  5. Plugins: NGXS has a plugin system built-in - it is similar to Redux's meta reducers. You can use existing plugins to extend the functionality on top of your store or you can build your own plugin. Plugins that NGXS offering you: Logger, Devtools, Storage, Forms, Web Socket, Router and more!
  6. Less Boilerplate: NGXS was originally invented in response to the complexity and amount of boilerplate present in other state management solutions.
  7. Backwards Compatibility: NGXS team very strongly stands for backwards compatibility so by migrating to a new version of NGXS you can be assured that your codebase won’t require significant changes as part of the upgrade.
  8. Consistency and Maintainability: In practice it is much easier to maintain applications that build with the same fashion. When you use NGXS it gives your code a place to live and common patterns will emerge that will make for a much more maintainable codebase.
  9. Documentation: NGXS has a great documentation at NGXS.io in addition to that you can find some blog posts about NGXS on medium blog.
  10. Community: The NGXS community is strong, you can join NGXS slack channel if you have any questions or if you want to discuss anything or just to say hello.
  11. NGXS labs: NGXS labs is an organization on github - the place to test out the new ideas and to play around and experiment with new cool features and new plugins that are not yet under the main NGXS organisation. Here is the list of the additional features and plugins currently available at NGXS labs:

      - Data - NGXS Persistence API
      - Emitter - provides the opportunity to feel free from actions
      - Immer adapter - declarative state mutations
      - Dispatch decorator - provide separation of concern between the state management and the view
      - Select snapshot - decorator that allows to get a snapshot of the state
      - Async storage plugin - async Storage Plugin
      - Entity state - entity adapter
      - Actions executing - notifies if action is being executed
      - Attach action - attaching independent, pure and easy to test Action Handlers to NGXS State
      - Firestore plugin - firestore plugin for NGXS

So as you can see there are lots of reasons why you may want to consider NGXS as a state management solution for your Angular applications. To get started check up the documentation at ngxs.io and if you have any questions you can join the slack channel to discuss or just comment below.

Posted on by:

kuncevic profile

Aliaksei Kuncevič

@kuncevic

Teaching Angular. Helping to adopt Angular in the most efficient way. NGXS Core Team. Organizing Angular Minsk and Frontend Tech meetups. Creator of frontendwatch.com

Discussion

markdown guide
 

Bingo -- NGXS rocks and I can't recommend @ngxs-labs/data highly enough! It is an excellent and well-designed simplification, over and above the awesome DX of NGXS itself.