ReferenceError: window is not defined
Hi - I get the error below passed from the server. My app is isomorphic. It looks like this module is only intended to work for react apps that render on the server. Is that correct or am I missing something? I am currently looking to see if I can suspend execution for the entire module if window is missing.
ReferenceError: window is not defined at /home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:25:17 at Array.map (native) at setState (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:21:16) at MatchMedia.updateState (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:62:18) at new MatchMedia (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:49:17) at Object.matchMedia as default at new Grid (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/components/Grid.js:138:41) at [object Object].ReactCompositeComponentMixin.mountComponent (/home/ubuntu/react/react-sandbox/node_modules/react/lib/ReactCompositeComponent.js:141:16) at [object Object].wrapper as mountComponent at Object.ReactReconciler.mountComponent (/home/ubuntu/react/react-sandbox/node_modules/react/lib/ReactReconciler.js:37:35)
Hi @elverskog,
Thanks for the report and I apologize for the amazingly late reply...
State management and media detection really need to be rework (I'll have free time the first week of November to handle it).
Solving missing window in media detection for server side rendering could be done easily, but I'll prefer to find a better workaround (or doc). I have to dig a bit more in this direction.
+1
Great module, but that window ... @broucz any suggested workarounds ?
https://webpack.js.org/plugins/provide-plugin/
Just got bit by this trying to use it with Next.js. Does anyone know if there is a work around to solve this?