title: Accessing the URL hostname from React JS
body: <p>I'm trying to access the URL subdomain. Traditionally in JavaScript I'd do</p>
  
  <pre><code>var full = window.location.host;
  var parts = full.split('.');
  var subdomain = parts[0];
  // ...
  </code></pre>
  
  <p>However I'm calling this from a React JS component, and I get the following error -</p>
  
  <pre><code>Encountered error "TypeError: undefined is not an object (evaluating 'window.location.host')"
  </code></pre>
  
  <p>It seems as though <code>window.location.host</code> doesn't work from React? Does it not have access to the window? </p>
  
  <p>I get there might be philosophical reasons to not do this, but I'd still be curious how to implement it if it's possible from React.</p>
  
  <p>Thanks!</p>