DEV Community

Discussion on: Reimplement Redux with vanilla React in 12 lines of code

Collapse
 
markerikson profile image
Mark Erikson

I'll point out my usual caveat whenever the "replace Redux with useReducer" discussion comes up:

Context has limitations with how it handles updates, specifically around components not being able to skip re-renders. Also, React-Redux has very different update characteristics because it uses store subscriptions.

See my posts React, Redux, and Context Behavior and A (Mostly) Complete Guide to React Rendering Behavior for complete details on the differences.

Collapse
 
scastiel profile image
Sebastien Castiel

Thanks for the additional information πŸ™‚

You are absolutely right, and I’m not suggesting to never use Redux again, I’m a big fan of Redux, especially coupled with Redux-Saga or Redux-Observable πŸ˜‰

But I enjoy a lot reimplementing some libraries I use, especially when beginners find them complex at first sight. This is mostly for an educational purpose. For the same reason, I wrote another post a while ago about implementing Redux (again) and Redux-Saga: Lost with Redux and sagas? Implement them yourself!

Collapse
 
emothek profile image
Mokhtar Megherbi

Actually, Context API and Hooks drawback is that re-rendering happens although there are many solutions including the one inspired by Dan Abramov and here you go :
1- github.com/facebook/react/issues/1...
2- blog.axlight.com/posts/benchmark-r...

3.... COME AND THANK ME :P

twitter : @MokhtarMegherbi