Do I really need Redux or Zustand if I have Context API?
When you're working on a React project...
There's one thing that's crucial for its success.
Every React project will need to do it.
Like it or not.
That's just how it is.
It's the essence of React.
You can't avoid dealing with this.
It's nothing more than this:
Managing state in React.
Alright, we get that. We know it.
Now comes the good part.
For me, it's good. For many, it's good. For others, it's bad. I guess, like everything in life.
Some see most things in a positive light. And others, well, the opposite.
As it should be.
The thing is...
React is not opinionated. That means it's up to you how to manage many things in your projects.
State management is one of them.
You can just use useState
... Or maybe Context.
If you need global state and more complexity, Redux? Zustand?
The truth is,
you need to know a few key points, some guidelines, and steps to choose the right approach for a project that's maintainable, easy to understand, and efficient.
So that when you come back to what you did yesterday, you understand it. You don’t sit there scratching your head.
So that when you need to add a new feature to the project or make changes...
You can do it in a reasonable time. Less than a day? Not an entire week trying to figure out what's goin on in the code.
And most importantly...
Especially for stakeholders and clients:
The performance of the app.
You definitely don’t want your app to be slow or freeze from time to time.
I don’t think that’s a good thing.
One of the worst things that can happen. It is what it is.
So, all of this. I mean, the key points, the guidelines, the steps to know:
When to use a global state manager in your React project or not
Do I really need Redux or Zustand if I have Context API
When to just stick with
useState
and that's itWhen to just use the Context API and that's it
Knowing if you need Zustand
When to use Zustand or Redux
When to use Zustand, Redux, Context, or
useState
When not to complicate the app if it's not necessary
All of this was added yesterday to the new Zustand course.
All these key points to help identify if you need a global state manager (Redux, Zustand...), Context API, useState
... are included in the course.
The course is currently in pre-sale. That means it's not available yet, but you can reserve it now at a special price before it's released.
By reserving it now during pre-sale, you get it for €10. Once it's launched, in a few weeks, you'll get immediate and lifetime access to the course. It's here:
P.S. Above, it will go up to €20 and then to €30. You can reserve it now for a special price of €10. Just the guidelines and key points added yesterday that you can already apply in your projects make it worth the investment.