title: How do I detect whether I am on server on client in next.js?
body: <p>I am using a customer express server with Next.js. It's running within a container. I am doing an http request with <code>isomorphic-fetch</code> to get data for my render. I'd like to do <code>localhost</code> when running on server and <code>mysite.com</code> when running on client. Not sure the best way to accomplish this. I can do it hackily by doing <code>const isServer = typeof window === 'undefined'</code> but that seems pretty bad. </p>