title: Next.js pass NODE_ENV to client
body: <p>I'm building a React SSR App, using Next.js.</p>
  <p>I want to be able to access the NODE_ENV on the client side, as this will tell my app which API endpoints to use.</p>
  <p>I'm struggling to find a decent approach for this. I'd like to define the NODE_ENV as a window variable when I first render the page on the server, and then in my helper function where I make the API call, I would check if the code is being called on the server or the client, and using the <code>window</code> or <code>process.env</code> objects as required.</p>
  <p>Does anyone have a good solution for such a problem? It must be a common issue but I can't find any good solutions.</p>