re: React Beginner Question Thread ⚛ VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

You use the react-redux utility with the mapStateToProps function, which does the thing as it's called, so that whenever the state (of the store) changes, the props changes as well. And it triggers the re-render of react components.

 

Thanks, Chang! I think I wasn't clear enough, I'm sorry! I meant the details of the implementation of such patterns.

Internally React Redux works by calling store.subscribe() when the component mounts. Every time the Redux store changes, the subscription callback fires. Inside it, React Redux calls React setState() by taking Redux store state and passing it through mapStateToProps().

Here’s a simple version: gist.github.com/gaearon/1d19088790...

Thank you so much! That's exactly what I wanted to know :D

Thanks Dan, the code example is really helpful. Also I found your video talk about react-redux very inspiring and straight-forward as well. For those who are interested, you can go to
youtube.com/watch?v=VJ38wSFbM3A. <3

code of conduct - report abuse