In my previous post, I talked about how NGRX has a lot of boiler-plate. Especially in regards to HTTP Requests. This is because you need to track the loading state, the actual request, and response objects as well as error handling. And if we’re being honest, 90% of the code is the same stuff, likely copied and pasted from other areas in the system because it’s faster to do it that way.
Well expanding on my previous post, rather than following a long, complex guide, that is out of date now as Angular and NGRX have kept evolving. It would be much simpler to just install the npm package and be done with it.
The good news is you do not need to convert all you’re actions, reducers, and effects over at once. You can easily do it, action by action, which allows you to not only get comfortable with the library but also means you can introduce it into your apps and libraries slowly.
The library itself can be found on my Github here. You can also check out a really quick demo here. We’ve been using this library at my workplace in production for 12 months now without any issues.
The library is also available on npmjs here.
Or if you want to get started straight away install it via the CLI, and look at the repository on how to us it.
npm i @acandylevey/ngrx-http-tracking