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

5. Predictable Reactive State Management

iliya
February 20, 2017
74

5. Predictable Reactive State Management

iliya

February 20, 2017
Tweet

Transcript

  1. Things we have to manage in out apps • Data

    that comes from the server and whether it's pending or resulted in an error • UI state like toggles, alerts and errors messages • User input, filters and search queries • Other
  2. Flux • Flux is an architecture for creating data layers

    in JavaScript applications. • It places a focus on creating explicit and understandable update paths for your application's data • Helps tracing changes during development and makes bugs easier to track down and fix
  3. Redux • Predictable state management • Architecture that keeps the

    core principles of Flux by having unidirectional data flow • Redux applications have only one global, read-only application state • This state is calculated by "reducing" over a collection or stream of actions that update it in controlled ways
  4. Redux Contracts • Reducers - Specification of how the state

    updates • High Order Reducers - Functions that take reducer as argument, take some additional arguments and return another reducer. • Selectors - Takes the whole states and returns a derived state
  5. Pros and cons using ngrx 1. Unidirectional data flow 2.

    Really helpful dev-tools (time travel) 3. Good code separation 4. Fast bug fixing due to 1, 2 and 3 5. Easier testing and reasoning due to pure functions and composition 6. Better angular performance with OnPush Strategy 7. More files and code