title: Managing 'window' object in Isomorphic App with ReactJS and Flask Python
body: <p>I am developing an application with Flask Backend with ReactJS front.
  ReactJS app has been developed and bundled with webpack. </p>
  
  <p>Everything works fine with client side rendering which is bundled with <code>webpack</code>. </p>
  
  <p>I am now trying to add server side rendering with <a href="https://github.com/markfinger/python-react" rel="noreferrer">python-react</a> . </p>
  
  <p>But problem is, I have to share some variables to my ReactJS app via <code>Jinja2 template</code> in base template <code>index.html</code> which has the <code>reactjs</code> root component node <code>&lt;div id='react-node'&gt;&lt;/div&gt;</code>.</p>
  
  <p>I had to send my <code>routes</code> and <code>config</code> to my application via <code>jinja2</code> template like below ,</p>
  
  <pre><code>//index.html
  
  &lt;!doctype html&gt;
  &lt;html&gt;
  ...
  ...
  
  &lt;script type='text/javascript'&gt;
    var STATIC_IMAGE_ROOT = "{{ url_for('static', filename='img/') }}";
    var ROUTES = { ... };
  ...
  &lt;/script&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>All the above js variables are being set to global <code>window</code> object . </p>
  
  <p>But when I am trying to render the component in python, it throws exception for <code>window</code> object <code>ReactRenderingError: react: ReferenceError: window is not defined</code> .</p>
  
  <p>What is the best way to solve this issue ? </p>