Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Redux - NgRx v8

Redux - NgRx v8

Explanation of how the redux pattern works and a brief introduction to NgRx v8

Example: https://stackblitz.com/edit/angular-ngrx-intro

Repo: https://github.com/mahcr/angular-costa-rica-redux

Mariano Alvarez

November 20, 2019
Tweet

More Decks by Mariano Alvarez

Other Decks in Programming

Transcript

  1. @malvarezcr WHO AM I? Web Practice Lead Co-Organizador de Angular

    Costa Rica Fan de JS, TS, NG, Web Techs, Pizza, Emojis Mariano Álvarez @malvarezcr
  2. @malvarezcr WHAT IS NGRX? “NgRx is a set of RxJS-powered

    state management libraries for Angular, inspired by Redux, a popular and predictable state management container for Javascript apps.”
  3. @malvarezcr PACKAGES • Store - RxJS powered state management for

    Angular apps, inspired by Redux. • Store Devtools - Instrumentation for @ngrx/store enabling time-travel debugging. • Effects - Side effect model for @ngrx/store. • Router Store - Bindings to connect the Angular Router to @ngrx/store. • Entity - Entity State adapter for managing record collections.
  4. @malvarezcr TERMINOLOGY Dispatch It is the method used to dispatch

    actions and trigger state changes to the store
  5. @malvarezcr FLUX VS REDUX Flux Redux Multiple Stores Singleton Dispatcher

    ‍♂ Mutable State Single Store ❌ No dispatcher ‍ Immutable State
  6. @malvarezcr PRINCIPLES ⚡ Single Source of Truth State is Read

    Only Store is updated by pure functions (reducers)
  7. @malvarezcr PROS VS CONS Pros Cons Easier to debug Separation

    of manipulation of data form the view Maintainability / Scalability Learning curve ❌ More code to write