DEV Community

Asim Dahal
Asim Dahal

Posted on

React state management. What should I use?

When I first started developing apps in react, I used redux along with redux-saga for state management and async tasks but after I came to know about the react hook 'useReducer' combined with the context API, I don't feel there is any necessity to use redux but I say many big companies using redux for state management. I am confused what should I be using. Should I stick to using redux or should I use the new useReducer hook combined with context API?

Top comments (4)

Collapse
 
dorshinar profile image
Dor Shinar

There's no one size fits all answer. It heavily depends on your application size, scale, team size and experience and what kind of things you'll store in your application. I find redux the more powerful of the two (time travel debugging is awesome), and I like having one store for all my FE data. However, context (with hooks) is really easy to work with (I find redux to have quite a steep learning curve), and it comes built in with react, so it saves you one dependency.
I suggest you experiment with both before you make a decision.

Collapse
 
asimdahall profile image
Asim Dahal

Debugging is awesome in redux, totally agree on that.

Collapse
 
emma profile image
Emma Goto 🍙

I think if you're making small side projects, you don't really need redux. But maybe you can make one app in redux just so you understand how it works, and then use hooks for all the rest?

Collapse
 
asimdahall profile image
Asim Dahal

I have used redux in production apps already, recently I came to know about react hooks and I don't find much difference between two so I was asking that if there is any advantages/disadvantages of using either of those?