Search:   Dictionary All Posts
Store Your Knowledge at the Brain Bank!

Redux Middleware for Async Operations

Summary - Thunk vs Saga vs Observable/RxJs vs Promise Middleware.
See source article for quick and easy setup guide for using all four of these redux middleware options. Handle async calls in any situation and know why to use which and when.

Thunk is the easiest to use but most difficult to test.

Saga is probably the best but has the steepest learning curve (but still pretty simple). It uses generators, which not many people are familiar with.

Observable uses RsJx and uses cancellation to optimize performance.

Promise Middleware - supposedly the best for just API calls, but falls short for other types of async actions.