DEV Community

Discussion on: Replacing React's Redux library with the useReducer Hook

Collapse
 
vdolbilov profile image
vdolbilov

Would you say there is any benefit to use useReducer over Redux? Looking at your code, it looks very similar to Redux boilerplate, but now you're dispatching via context instead of using mapDispatchToProps standard in react-redux.

If you're starting a new project, this works since you no longer have to bring in Redux, though things like Redux Toolkit may provide a better experience over hooks. But if I already have Redux in my app, is there any reason to switch over? Or is useReducer just some glue for your application before you make the full transition to Redux when you need it?

Collapse
 
kendalmintcode profile image
Rob Kendal {{☕}}

Howdy, apologies for the delay in responding. Apparently Dev didn't fancy notifying me of this comment!

So, in all honesty, I'm using the Redux Tookit in our production project and I have no intention of swapping over to using my approach in this article. However, if I started a new project, I'm going with useReducer.

I think there are benefits to using useReducer, for sure, but I think they would be eclipsed by the effort involved in switching from your existing Redux setup in order to use it.