0

I'm using react and server side rendering. When rendering my component I need access to window object as I need to know the width on the window. I got sunch an error in the console: enter image description here

How can I use window object with server side rendering in react?

rick1
  • 946
  • 3
  • 15
  • 31
  • well the serverside does not have window so you might have to rethink it. – epascarello Jun 26 '18 at 15:26
  • Possible duplicate of [https://stackoverflow.com/questions/38951721/react-js-server-side-issue-window-not-found](https://stackoverflow.com/questions/38951721/react-js-server-side-issue-window-not-found) – Chetan Jadhav CD Jun 26 '18 at 15:32
  • Depending on what you need to access on the window, you may need to change your implementation to use one of React's lifecycle hooks that runs in the browser, please post a code snippet showing how you are using window – Steve Vaughan Jun 26 '18 at 20:30
  • I would like to have access to window.innerWidth and update it if it changes – rick1 Jun 27 '18 at 07:36

0 Answers0