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

Async in Redux Workshop: Module 5

Freddy Rangel
March 14, 2017
24

Async in Redux Workshop: Module 5

Freddy Rangel

March 14, 2017
Tweet

Transcript

  1. GENERATORS ▸ Generators are functions which can be exited and

    later re-entered. Their context (variable bindings) will be saved across re-entrances. ▸ Generators have 2 parts: a generator function and generator object ▸ Generator objects have a `next()` method that returns on object with `value` and `done` attributes
  2. REDUX-SAGA ▸ A Redux implementation of the Saga Pattern. ▸

    Based on generators. ▸ Instead of dispatching Thunks, you create Sagas to gather all your Side Effects logic in a central place. ▸ This means application logic lives in 2 places: ▸ Reducers are responsible for handling state transitions between actions. ▸ Sagas are responsible for orchestrating complex/asynchronous operations.
  3. SAGA PATTERN ▸ Saga is a failure management pattern. ▸

    Sagas are multiple workflows, each providing compensating actions for every step of the workflow where it can fail. ▸ You can think of Sagas as daemons, a long living process for orchestrating transactions and handling recovery from failures.