I'm trying to access the URL subdomain. Traditionally in JavaScript I'd do
var full = window.location.host;
var parts = full.split('.');
var subdomain = parts[0];
// ...
However I'm calling this from a React JS component, and I get the following error -
Encountered error "TypeError: undefined is not an object (evaluating 'window.location.host')"
It seems as though window.location.host doesn't work from React? Does it not have access to the window?
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.
Thanks!