Thoughts on React/Redux (Hopefully useful to others)

I was redoing this React/Redux lesson, and I had to re-read it many times, as I kinda glossed over the lesson text out of confusion the first time, and figured that I’d learn through doing. This time, I’ve been seeking true understanding, and think my notes might be helpful to others


mapStateToProps: using store.subscribe(), subscribes a property of your React component to a piece of state in your Redux Store.

  • When the relevant piece of state changes, new props are sent to the target component
  • This wires the flow of info down the DOM tree represented here:

Credit: CSS Tricks

mapDispatchToProps: using store.dispatch(), sends a dispatch containing an action from your React component to the Redux Store.

  • When the dispatch is received, the store will reduce the (state, action) tuple to a new state with the relevant piece of state updated.
  • This wires the flow of info up from the component in the DOM tree to the store in the image above.
2 Likes