DEV Community

Discussion on: Learn the Basics of Redux by Writing Your Own Version in 30 Lines

Collapse
 
hugoazevedosoares profile image
hugoazevedosoares

Nice explanation! One thing that I always wondered is how does redux connect with react 'reactivity system'. I never understood how changes in the redux store propagate to the react components.

Collapse
 
devhammed profile image
Hammed Oyedele

It is using publish and subscribe pattern under the hood, look at the file responsible for it at github.com/reduxjs/redux/blob/mast...

Collapse
 
hugoazevedosoares profile image
hugoazevedosoares

Thanks Hammed! But I still don't know how it hooks with React components exactly. For Vue I can imagine how it would work, but not for React... Do you have any idea of which API Redux uses for this?

Thread Thread
 
hugoazevedosoares profile image
hugoazevedosoares

Oh, they use ContextAPI. Never mind, I think I got it now!

github.com/reduxjs/react-redux/blo...

Thread Thread
 
devhammed profile image
Hammed Oyedele

Definitely, the React bindings uses Context API under the hood as seen here: github.com/reduxjs/react-redux/blo...

Thread Thread
 
devhammed profile image
Hammed Oyedele • Edited

Lol, I have replied before I saw your comment 😂