Skip to content

Could not find "store" in the context of "Connect(WithStyles)". #1319

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

Closed
greygatch opened this issue Jun 13, 2019 · 1 comment
Closed

Could not find "store" in the context of "Connect(WithStyles)". #1319

greygatch opened this issue Jun 13, 2019 · 1 comment

Comments

@greygatch
Copy link

greygatch commented Jun 13, 2019

Do you want to request a feature or report a bug?
bug

What is the current behavior?
I get an error:

Invariant Violation: Could not find "store" in the context of "Connect(WithStyles)". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to Connect(WithStyles) in connect options.

This error is:
{ Invariant Violation: Could not find "store" in the context of "Connect(WithStyles)". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to Connect(WithStyles) in connect options. at invariant (/Users/evan.gatchell/code/resubmit-ui/node_modules/invariant/invariant.js:40:15) at Connect.renderWrappedComponent (/Users/evan.gatchell/code/resubmit-ui/node_modules/react-redux/lib/components/connectAdvanced.js:162:32) at a.render (/Users/evan.gatchell/code/resubmit-ui/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:437) at a.read (/Users/evan.gatchell/code/resubmit-ui/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:436) at renderToString (/Users/evan.gatchell/code/resubmit-ui/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:51:83) at render (/Users/evan.gatchell/code/resubmit-ui/node_modules/next-server/dist/server/render.js:86:16) at Object.renderPage (/Users/evan.gatchell/code/resubmit-ui/node_modules/next-server/dist/server/render.js:211:20) at Function.module.exports.5w0S._Document.getInitialProps.ctx [as getInitialProps] (/Users/evan.gatchell/code/resubmit-ui/.next/server/static/XZU0ghjI86u3oGdCeahHH/pages/_document.js:411:20) at Object.loadGetInitialProps (/Users/evan.gatchell/code/resubmit-ui/node_modules/next-server/dist/lib/utils.js:42:35) at Object.renderToHTML (/Users/evan.gatchell/code/resubmit-ui/node_modules/next-server/dist/server/render.js:218:36) name: 'Invariant Violation', framesToPop: 1 }

What is the expected behavior?
Everything works in dev mode, but when I run build and start with Next.js, I get this error.

Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
Redux v4.0.1
React Redux v6.0.0

Misc
Here's the part where I use connect. If I remove the "withStyles" bit, I get the same error, but for the Index component.

export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(Index))

@timdorr
Copy link
Member

timdorr commented Jun 13, 2019

Something is stripping out your <Provider>. But it's not this library doing it, so you're going to have to look at your build tooling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants