markerikson / marks-dev-blog-comments

Comments for my blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blogged Answers: React, Redux, and Context Behavior

utterances-bot opened this issue · comments

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

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

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.

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"?

@aqarain :

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

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