Should You Learn Redux?
Steven Mercatante
Posted on November 7, 2019
This post was originally published at stevemerc.com
Reading some Redux example code I wrote four years ago and I have no effing idea what's going on there22:47 PM - 04 Nov 2019
(In case you're unaware, Dan co-created Redux.)
Ever since React's context API became stable, and especially after the release of hooks, a boatload of posts told us that Redux was on its deathbed. Who needs Redux when we've got the context API? Who wants to write all that boilerplate code? It's way too verbose when all I want to do is push an item to an array!
I don't necessarily disagree with those sentiments. Redux can be a pain to use, but sometimes it's the right choice for a project.
I want to pause here and say that I'm really grateful for Redux. Its creators and maintainers have spent a ton of time and energy in making a powerful tool. I've made good money working on projects that use it. And it's probably single handedly responsible for teaching more people how reduce
works than anything else.
So, Should You Learn Redux?
When a post asks if you should learn something, the answer is usually "it depends." But not this post. Yes, you should learn Redux.
Regardless of the flak it gets, it's still the most popular state management library for React apps. It's battle tested, has incredible tooling, and there's a large community around it. If you've got a question, someone's already answered it.
This means that you're likely going to encounter and work on a project that uses it. And no matter how much you protest that there's a better option (maybe there is, maybe there isn't), you're gonna have to use it. So, rather than fight it, embrace it.
The official docs are great. Spend some time with them. Redux isn't the easiest library to grok, which is why knowing how it works is useful before you find yourself neck deep working in a project that uses it.
I'd also recommend learning how Reselect and Immer work. They're not necessary to use Redux, but they can improve performance and readability, and it's not uncommon to see them used alongside Redux.
[Edit: also check out Redux Starter Kit, mentioned by Mark Erikson in the comments below.]
Should You Use Redux?
This is where I respond with "it depends". Personally, I've stopped using Redux for new projects. Local state and the context API can get you very far. And when I need something more powerful, I use MobX. The balance it strikes between Redux and not-Redux is great. But, as a consultant, I often find myself working on projects that use Redux, and knowing how it works is essential.
In the end, the choice to learn Redux and the choice to use it are two different things. I think it's at least worth learning.
👋 Enjoyed this post?
Join my newsletter and follow me on Twitter @mercatante for more content like this.
Posted on November 7, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.