You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not aware of a service for code demo with SSR. So I'm linking to a minimal repository to demonstrate the current behavior of a React/Redux app with SSR.
npm run start (with SSR)
Visiting http://localhost:8080 (white screen), terminal outputs this error: { Invariant Violation: Could not find "store" in the context of "Connect(Component)". [...].
npm run start:client
Normal behavior.
What is the expected behavior?
I expected react-redux to find store with SSR.
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
Just looking at things, it's likely something to do with webpack-hot-server-middleware. It does weird things around the rendering function and requiring from a string value of the file's contents, not just requiring the file itself. This is likely breaking out the code into a separate VM realm, so the Context instance in the server renderer isn't the same as the client. Looks like a caveat of that package, not React Redux.
Indeed, it's working with my production build. I will look at what's going on inside webpack-hot-server-middleware. Thank you for your help and sorry to not have thought to test it in production before creating this issue.
EDIT (solution): for people SSRing in development and struggling with this Could not find "store" in the context error, make sure that your server bundle was not built with Webpack mode: production.
Do you want to request a feature or report a bug?
A bug (imho).
What is the current behavior?
I'm not aware of a service for code demo with SSR. So I'm linking to a minimal repository to demonstrate the current behavior of a React/Redux app with SSR.
npm run start
(with SSR)Visiting http://localhost:8080 (white screen), terminal outputs this error:
{ Invariant Violation: Could not find "store" in the context of "Connect(Component)". [...].
npm run start:client
Normal behavior.
What is the expected behavior?
I expected
react-redux
to findstore
with SSR.Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
Chrome and Debian Stretch as a Vagrant guest inside Windows.
The expected behavior is still obtained with the previous versions of React Redux (5.1.1).
Additional notes
It might be related to how
renderToString
works.renderToStaticMarkup
doesn't work either. I'm not very familiar with the logic of those functions.I really hope it's not a usage error on my side.
The text was updated successfully, but these errors were encountered: