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.
Redux
How I understood React-Redux is that
React-Redux
connect
store.subscribe(...)
mapStateToProps
store.getState()
mapDispatchToProps
(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.
store
event channel
Here is the working source after following your tutorial codesandbox.io/s/xvk991y4zo
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 thatconnect
(React-Redux) "subscribes" (usingstore.subscribe(...)
behind the scene) react components to Redux store.mapStateToProps
gets data from Redux store (by callingstore.getState()
) and passes it to a react component as a prop.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 theevent channel
.Here is the working source after following your tutorial
codesandbox.io/s/xvk991y4zo