What it is
Redux Saga is a middleware for managing side effects using generator functions. Instead of dispatching functions like thunks, you write sagas that yield effect descriptions, and the middleware runs them.
Declarative effects
A saga does not call an API directly. It yields a description such as call with the function and arguments. The middleware performs the work, which makes sagas easy to test because you assert on the yielded plain objects.
- call: invoke a function and wait for the result.
- put: dispatch an action.
- take: wait for a specific action.
- fork: start a task without blocking.
Watchers and workers
A common shape is a watcher saga that takes every matching action and spawns a worker saga to handle it. Helpers like takeLatest automatically cancel a previous run, which solves race conditions cleanly.
Key idea
Sagas use generators to yield declarative effects, giving you testable, cancellable control over complex asynchronous flows.