DEV Community

Cover image for Replace Redux with Hooks and the Context API: how to

Replace Redux with Hooks and the Context API: how to

Riccardo Coppola on March 16, 2020

Is it possible to use the new React Context API and hooks to completely replace Redux? Is it worth it? Does it yield the same results and is the so...
Collapse
 
iarmankhan profile image
Arman Khan

Great article. Got a nice refresh of context API. Thanks

Collapse
 
ricca509 profile image
Riccardo Coppola

Thanks Arman

Collapse
 
s0xzwasd profile image
John Doe

Thank you for the article! This is a new fresh look at old problems and an option to solve them.

Collapse
 
ricca509 profile image
Riccardo Coppola

Glad you found it useful Daniil.

Collapse
 
chathula profile image
Chathula Sampath

awesome guide! love it!

Collapse
 
josemunoz profile image
José Muñoz

just FYI, when working with providers make sure the child is a pure component (if its functional that means it's wrapped in React.memo)

Collapse
 
ricca509 profile image
Riccardo Coppola

Hi,
thanks for your comment, could you please elaborate on that?

Thanks!

Collapse
 
josemunoz profile image
José Muñoz • Edited

Let me borrow some credibility

Thread Thread
 
ricca509 profile image
Riccardo Coppola • Edited

That makes sense now, thanks!

Collapse
 
dastasoft profile image
dastasoft

Great article!

The downside I see replacing Redux is you will lose the debug tools that comes with Redux which are very handy, but for small-medium projects maybe it's the best solution.

Collapse
 
ricca509 profile image
Riccardo Coppola

Thanks!
You're right, to some extent you can debug React Hooks and see what the state looks like, but you don't get the nice actions debug/log and the timeline (not unless a bit of development).

I guess it can be ok with small projects as you say, with bigger ones the number of actions and interactions may require better debugging.