Redux 4 Ways
Implementations of Thunk vs Saga vs Observable vs Redux Promise Middleware in 10 minutes.
At the last React Native online meetup, I gave a presentation on the differences of Thunk vs Saga vs Redux Observable (see slides here).
These libraries offer ways to handle side effects or asynchronous actions in a redux application. For more information on why you may need something like this, see this link.
I thought I would take this one step further and not only create a repo for viewing and testing these implementations, but walk through how they are implemented step by step and add one more implementation, Redux Promise Middleware.
When I first started with redux, wrapping my head around these asynchronous side effect options was overwhelming. Even though the documentation was not bad, I just wanted to see the most absolute basic implementations of each in action to give me a clear understanding of how to get started with them without wasting a bunch of time.
In this tutorial, I’ll walk through a basic example of fetching and storing data in a reducer using each of these libraries.