DEV Community

Discussion on: You probably don't need Redux: Use React Context + useReducer hook

Collapse
 
leob profile image
leob • Edited

Good explanation, but I can't help but notice how similar the code looks compared to what you would write if you use Redux - you still write reducers, actions, dispatch, etcetera ... so, I could be wrong, but at first sight we don't seem to have gained much in terms of reducing boilerplate.

The only simplification then seems to be that we can omit one or two dependencies from our package.json (but Redux doesn't add that much to the bundle size, it's a pretty small library).

Note that I'm not saying that this approach (Context) is worse than using Redux, but I also don't see immediately how it's better or simpler - the way you manage state with Context is largely the same.

Or am I missing something?

Collapse
 
nikhilkumaran profile image
Nikhil Kumaran S

You are right. I never considered "reducing boilerplate" as a goal. I wanted to show that we can achieve redux like functionality in vanilla react itself.

Collapse
 
leob profile image
leob

Understood ... but look at this one - we might not need Redux, but we might even also not need Context! dev.to/g_abud/why-i-quit-redux-1knl

Thread Thread
 
nikhilkumaran profile image
Nikhil Kumaran S

Sure will check it out✌🏽