DEV Community

Muhammad Wasif
Muhammad Wasif

Posted on

Should I use Redux?

State management is a huge and important part of a big application. In libraries like React, Redux has always been popular.
However, in past few days I came to know about these tweets.


And,

And these are quit right. Redux make the code complex.
So, should I keep using it or React Context is a good alternative?
What do you say about it? Is Redux deprecated?

Latest comments (22)

Collapse
 
peteryuan profile image
Peter Yuan

To be honest, Mobx is my choice.

Collapse
 
kuzzzzz profile image
kuzzzzz

built and app recently without redux and it sucked managing all the different states via each component

Collapse
 
shivarajnaidu profile image
yuvaraj

We can use Service Pattern Along With RxJs (like we do it in angular) ,... It can replace redux right ?

Collapse
 
jeromedeleon profile image
Jerome De Leon

I will not use it right off the bat just because someone tells me to do so unless the scenario is telling me that hooks are making too much noise around my component, but then again instead of putting all hooks inside a component, why not just move it into a custom hook?

Collapse
 
mariosant profile image
Marios Antonoudiou

What we call Redux are actually two things:

  1. Application level state and
  2. The action/reducer/middleware boilerplate.

I believe most engineers tend to add more application level state than they should, creating weird couplings and making things unnecessary complex. Ie, do you really need the data from those records to application level state?
More to that, action/reducer combination can get more complex than what it should. Mostly because engineers also tend to couple these as well.

Collapse
 
diek profile image
diek

Redux is a mess in a large team/app, without a properly use it can even lock the browser and you never will not know why. It's powerful, but needs to be used with careful.

Collapse
 
sebbdk profile image
Sebastian Vargr • Edited

Teams make the same bad state without it in my experience.

The difference being, with' a state-manager, you know' when your state is a mess. :)

Collapse
 
perpetualwar profile image
Srđan Međo

Beware of random tweets.

Collapse
 
thewasif profile image
Muhammad Wasif

Those are opinions 🙂

Collapse
 
perpetualwar profile image
Srđan Međo

My point still stands.

Collapse
 
simme profile image
Simme • Edited

I love redux! However, I still like to follow a particular advice one of my colleagues gave me when I tried to learn it some years ago:

Don’t use it as your go to-solution. Use it only when you need to do things with side effects (like load data), or when multiple parts of the app have an interest in the same state.

Collapse
 
thewasif profile image
Muhammad Wasif

Looks like a good advice

Collapse
 
richardrobberse profile image
Richard Robberse

I'm still convinced Redux is great if you build your application in the right way.
Just let the data flow through the state, let your components render accordingly and try not to bloat your components with code that could be placed in an action.

I've started a new project last week with Redux toolkit and I have to say it's really easy to get started and it scales out well if you define your slices properly.
I did, however, decouple the component from the slice because there's almost never a 1-to-1 relationship between a slice of the state and a component.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.