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.
Redux: You know EXACTLY where your state is.
...You just don't know where the code that manages your state is.00:41 AM - 22 Mar 2020
And,
@catalinmpit @freeCodeCamp Drop regex and Redux
- regex look of up when you need it.
- redux well even @dan_abramov has some feelings about and he creates it... Unless you plan to work on systems that have but learn it then. Maybe familiarize yourself with it14:48 PM - 21 Mar 2020
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)
To be honest, Mobx is my choice.
built and app recently without redux and it sucked managing all the different states via each component
We can use Service Pattern Along With RxJs (like we do it in angular) ,... It can replace redux right ?
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?
What we call Redux are actually two things:
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.
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.
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. :)
Beware of random tweets.
Those are opinions 🙂
My point still stands.
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:
Looks like a good advice
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.