title: how to use React.useState(window.innerWidth) in server side rendering
body: <p>React.useState(window.innerWidth) is failing due to server-side rendering as there is no window object in server-side.
  How can I fix it?
  I have been trying code in this link 
  <a href="https://blog.logrocket.com/developing-responsive-layouts-with-react-hooks/" rel="nofollow noreferrer">https://blog.logrocket.com/developing-responsive-layouts-with-react-hooks/</a></p>