-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to obtain store in a component #948
Comments
Yeah, accessing the store directly is definitely not part of the public React-Redux API. Now, because When we switch to using the new context API provided by React 16.3, all that unofficial usage will break, because That said, there's certainly nothing stopping you from having your own context-based method of passing down the store to your own components. |
sure, there are definitely ways around it. I basically agree that standard use-case does not involve directly playing with Thanks for considerations. |
For now, you can use the legacy Context API to get access to it. In the future, when we use the new Context API, we'll provide that context's Consumer as an export, so you can get to it that way. |
Hi there,
this is most likely a question or enhancement proposal. I know that I could get store by using old context API - but this looks not to be part of official API. It looks to me like the internal implementation that can change (e.g. with new React Context implementation). Is there a official way to retrieve the store?
My motivation:
I am using redux-saga and I like the way how they "enhanced" store in their example in official API
I would like to execute
runSaga
in my components and therefore need get thestore
. And as store is already provided byProvider
it would be convenient to able to retrieve it somewhere down the road in official way.I know that this is not direct responsibility of
react-redux
but I believe other users could benefit from (or misuse) such feature as well :)The text was updated successfully, but these errors were encountered: