You Might Not Need Redux
Dan Abramov
6.1K68

I felt the drawbacks from relying solely on Redux when it comes to interactions that lead to complicated workflows — say you hit a button, which needs to fire off an async request and capture the result of it, but then based on the result, you need to perform another action, and another, and rinse and repeat.

There’s `redux-thunk`, but then your actions have mixed responsibilities and it becomes much less predictable and less pure. And then the alternative is for components to observe the results of a sequence of actions with `componentWillReceiveProps`, but now your component is orchestrating many state transitions when it wanted to just do one thing.

But then I started to understand how `redux-saga` works and why/how you may want to use it. I’d say that most of my shortcomings with Redux were solved by `redux-saga`. I love the separation with this toolset:

  • React Components — purely presentational
  • Redux Actions — transition state
  • Reselect — derived data based on my store
  • Middleware for Asynchronous Actions — allows me to create an action that perform an asynchronous task, resulting in 3 possible stages (request, and success or failure) — basically follows the FSA format, but with a `status` property describing the stage of the asynchronous action.
  • Redux-Saga — Orchestrates multi staged state transitions

To me, this completes the picture

Show your support

Clapping shows how much you appreciated Atticus White’s story.