Error `window not defined` in Node.js
<p>I know <code>window</code> doesn't exist in Node.js, but I'm using React and the same code on both client and server. Any method I use to check if <code>window</code> exists nets me:</p>

<blockquote>
  <p>Uncaught ReferenceError: window is not defined</p>
</blockquote>

<p>How do I get around the fact that I can't do <code>window &amp;&amp; window.scroll(0, 0)</code>?</p>