{"action":"created","issue":{"url":"https://api.github.com/repos/reduxjs/react-redux/issues/948","repository_url":"https://api.github.com/repos/reduxjs/react-redux","labels_url":"https://api.github.com/repos/reduxjs/react-redux/issues/948/labels{/name}","comments_url":"https://api.github.com/repos/reduxjs/react-redux/issues/948/comments","events_url":"https://api.github.com/repos/reduxjs/react-redux/issues/948/events","html_url":"https://github.com/reduxjs/react-redux/issues/948","id":322497086,"number":948,"title":"Ability to obtain store in a component","user":{"login":"sodik82","id":6132259,"avatar_url":"https://avatars1.githubusercontent.com/u/6132259?v=4","gravatar_id":"","url":"https://api.github.com/users/sodik82","html_url":"https://github.com/sodik82","followers_url":"https://api.github.com/users/sodik82/followers","following_url":"https://api.github.com/users/sodik82/following{/other_user}","gists_url":"https://api.github.com/users/sodik82/gists{/gist_id}","starred_url":"https://api.github.com/users/sodik82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sodik82/subscriptions","organizations_url":"https://api.github.com/users/sodik82/orgs","repos_url":"https://api.github.com/users/sodik82/repos","events_url":"https://api.github.com/users/sodik82/events{/privacy}","received_events_url":"https://api.github.com/users/sodik82/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-12T09:29:45Z","updated_at":"2018-05-13T07:15:38Z","closed_at":null,"author_association":"NONE","body":"Hi there,\r\n\r\nthis 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](https://github.com/reactjs/react-redux/blob/master/docs/api.md). 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?\r\n\r\nMy motivation:\r\nI am using redux-saga and I like the way how they \"enhanced\" store in their [example in official API](https://redux-saga.js.org/docs/api/)\r\n\r\n```\r\nexport default function configureStore(initialState) {\r\n  // Note: passing middleware as the last argument to createStore requires redux@>=3.1.0\r\n  const sagaMiddleware = createSagaMiddleware()\r\n  return {\r\n    ...createStore(reducer, initialState, applyMiddleware(/* other middleware, */sagaMiddleware)),\r\n    runSaga: sagaMiddleware.run\r\n  }\r\n}\r\n```\r\n\r\nI would like to execute `runSaga` in my components and therefore need get the `store`. And as store is already provided by `Provider` it would be convenient to able to retrieve it somewhere down the road in official way. \r\n\r\nI know that this is not direct responsibility of `react-redux` but I believe other users could benefit from (or misuse) such feature as well :)"},"comment":{"url":"https://api.github.com/repos/reduxjs/react-redux/issues/comments/388606596","html_url":"https://github.com/reduxjs/react-redux/issues/948#issuecomment-388606596","issue_url":"https://api.github.com/repos/reduxjs/react-redux/issues/948","id":388606596,"user":{"login":"sodik82","id":6132259,"avatar_url":"https://avatars1.githubusercontent.com/u/6132259?v=4","gravatar_id":"","url":"https://api.github.com/users/sodik82","html_url":"https://github.com/sodik82","followers_url":"https://api.github.com/users/sodik82/followers","following_url":"https://api.github.com/users/sodik82/following{/other_user}","gists_url":"https://api.github.com/users/sodik82/gists{/gist_id}","starred_url":"https://api.github.com/users/sodik82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sodik82/subscriptions","organizations_url":"https://api.github.com/users/sodik82/orgs","repos_url":"https://api.github.com/users/sodik82/repos","events_url":"https://api.github.com/users/sodik82/events{/privacy}","received_events_url":"https://api.github.com/users/sodik82/received_events","type":"User","site_admin":false},"created_at":"2018-05-13T07:15:38Z","updated_at":"2018-05-13T07:15:38Z","author_association":"NONE","body":"sure, there are definitely ways around it.\r\n\r\nI basically agree that standard use-case does not involve directly playing with `store`, so \"easiest\" solution might be to provide `injectStore` HOC (or `Consumer` as `Provider` counterpart) for such use-cases.\r\n\r\nThanks for considerations.  "}}
{"actor":{"display_login":"sodik82"}}