React Side Effects (Redux)
Guide from Redux docs on side effects and how to manage them
The lowest-level technique for managing side effects with Redux is to write your own custom middleware that listens for specific actions and runs logic. However, that’s rarely used. Instead, most apps have historically used one of the common pre-built Redux side effects middleware available in the ecosystem: thunks, sagas, or observables. Each of these has its own different use cases and tradeoffs.
More recently, our official Redux Toolkit package has added two new APIs for managing side effects: the “listener” middleware for writing reactive logic, and RTK Query for fetching and caching server state.