title: JSON object vs window variable for passing server-side rendered initial state using reactjs
body: <p>In an isomorphic application with Reactjs, you need to pass the identical initial state that was rendered on the server down to the client (which will then 'rehydrate' the app with event bindings and such).</p>
  
  <p>I've seen two approaches to passing this initial state down--</p>
  
  <p>Setting a global variable to the window:</p>
  
  <pre><code>&lt;script&gt;
  window.initialState = {{JSON.stringify(initialState)}} ;
  &lt;/script&gt;
  </code></pre>
  
  <p>Or passing it as a JSON object:</p>
  
  <pre><code>&lt;script id="initial-state" type="application/json"&gt; {{JSON.stringify(initialState)}}&lt;/script&gt;
  </code></pre>
  
  <p>Both are easily retrievable from anywhere in the application. Are there any advantages to using one over the other?</p>