DEV Community

Discussion on: Clean React-Redux, Redux-Saga client-side solution.

Collapse
 
phryneas profile image
Lenz Weber

Please note that this is all based on a very old style of Redux itself that we are no longer teaching for production use.
We officially recommend to use the official Redux Toolkit for any Redux code written nowadays - in new projects as well as in old projects.
Working with Redux Toolkit, you won't have to deal with switch..case reducers, ACTION_TYPE string constants, immutable reducer logic and all that stuff. It essentially reduces your code to a fourth, works much better with TypeScript and includes RTK-Query, which is essentially "React Query for Redux".
I'd recommend going with the official Redux tutorial to get up to speed with the most modern approaches: redux.js.org/tutorials/essentials/...

Collapse
 
alanst32 profile image
alanst32

Thanks for the comment, I am aware of React Query, I am working in something right now maybe I will post it here. My main objective was to describe Saga, so I have done in the "old" way to point step by step. I thought the modern approach would be a material for another article ;)

Collapse
 
phryneas profile image
Lenz Weber

Just to make sure: I am not talking about "React Query" here. I am talking about "RTK Query", which is part of the official Redux Toolkit.

And also when using Saga, the general official recommendation to use Redux Toolkit for that still stands (for two years now: redux.js.org/style-guide/style-gui...).

We are not teaching Vanilla Redux for any kind of production use any more and it would be great to see articles picking up on that.

Thread Thread
 
alanst32 profile image
alanst32

Good to know, I will take a look on the links. My projects lately have been with RxJs, so I guess I need to catch up with Redux modern approaches. But is like I always say Adapt and Evolve.
Cheers mate.