DEV Community

[Comment from a deleted post]
Collapse
 
dance2die profile image
Sung M. Kim

I've been struggling 😣 because I couldn't differentiate 'redux' from 'react-redux'.

Your article was easiest to understand because of having to learn basics of Redux first & how it's used in React.

How I understood React-Redux is that

  1. connect (React-Redux) "subscribes" (using store.subscribe(...) behind the scene) react components to Redux store.
  2. mapStateToProps gets data from Redux store (by calling store.getState()) and passes it to a react component as a prop.
  3. mapDispatchToProps receives a dispatcher/publisher, which let any action to be called on Redux side.

(Would you review if my understanding 👆 is correct? 🙏)

And I noticed that Redux is just a glorified global Singleton object, which is based on a pub/sub pattern where store is the event channel.

Here is the working source after following your tutorial
codesandbox.io/s/xvk991y4zo