Chapter 15. Maintaining app state with ngrx

 

This chapter covers

  • A brief introduction to the Redux data flow
  • Maintaining your app state using the ngrx library
  • Exploring another implementation of the Mediator design pattern
  • Implementing state management in ngAuction with ngrx

You’ve made it to the last chapter, and you’re almost ready to join an Angular project. The previous chapter was easy reading, but this chapter will require your full attention; the material we’re about to present has many moving parts, and you’ll need to have a good understanding of how they play together.

ngrx is a library that can be used for managing state in Angular apps (see https://github.com/ngrx). It’s built using the principles of Redux (another popular library for managing state), but the notification layer is implemented using RxJS. Although Angular has other means for managing app state, ngrx is gaining traction in mid- and large-size apps.

Is it worth using the ngrx library for managing state in your app? It certainly has benefits, but they don’t come free. The complexity of your app can increase, and the code will become more difficult to understand by any new person who joins the project. In this chapter, we cover the ngrx library so you’ll be able to decide whether it’s the right choice for managing the state of your app. In the hands-on section, we do a detailed code overview of yet another version of ngAuction that uses ngrx for state management.

15.1. From a convenience store to Redux architecture

15.2. Introducing ngrx

15.3. To ngrx or not to ngrx

15.4. Hands-on: Using ngrx in ngAuction

Summary

Angular 6, 7, and beyond

sitemap