markerikson / marks-dev-blog-comments

Comments for my blog
4 stars 0 forks source link

Blogged Answers: React, Redux, and Context Behavior #50

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Blogged Answers: React, Redux, and Context Behavior · Mark's Dev Blog

https://blog.isquaredsoftware.com/2020/01/blogged-answers-react-redux-and-context-behavior/

YagamiNewLight commented 2 years ago

Very great article! But I got a question about the usage of the context: In the useSelector implementation. Can we just import store instance directly? What's the benefit of using React Context? Thanks in advance.

aqarain commented 1 year ago

You have mentioned "redux uses context only to pass the Redux store instance down to child components - it doesn't pass the store state using context!" What is the difference between the "store instance" and "store state"?

markerikson commented 1 year ago

@aqarain :

// store instance
const store = configureStore({reducer});

// store state, aka "the latest value"
const state = store.getState()