Slide 39
Slide 39 text
SUMMARY
Sagas:
Pros:
‣ Got to dispatch a separate action
to run
‣ ES6 generator knowledge
‣ Easy to test
‣ Has cancellation
‣ Flexible with saga effects - fork,
spawn, cancel, throttle
Cons:
‣ ES6 generator knowledge
‣ Can be harder to maintain if not
done right
‣ As app scales, harder to do
cancellation
Thunks:
Pros:
‣ Really easy to understand
‣ Can be used for smaller projects
Cons:
‣ Return promises
‣ Promises cannot be cancelled
‣ Hard to test as you are testing
functions
‣ Tightly coupled
‣ Hard to reuse
‣ is a function that returns a function
‣ Call back hell
‣ Too much nesting
‣ Code readability
‣ No way to cancel, debounce, retry
Observables:
Pros:
‣ You got to filter from a set of
actions
‣ Rx js knowledge
‣ Can be transformed
‣ Can be re-used very easily
‣ Built-in debounce, throttle,
‣ Are lazy so you can retry, repeat
‣ Epic - actions in, actions out
‣ Are very powerful
Cons:
‣ Testing is a bit more difficult than
sagas
‣ RxJS has a huge learning curve
‣ Not all apps need that much power