title: React Context undefined in Server Side Render
body: <p>I am trying to pass in data during server side rendering for a simple app.</p>
  
  <p>I have this data provider both in the server and client and I use a global variable to inject the initial state into the client:</p>
  
  <pre><code>import React, { Component } from 'react';
  
  export default class SsrDataProvider extends Component {
    constructor(props) {
      super(props);
      this.state = { data: window.__INITIAL_STATE__ };
    }
  
    getChildContext() {
      return { data: this.state.data };
    }
  
    render() {
      return this.props.children;
    }
  }
  
  SsrDataProvider.propTypes = {
    children: React.PropTypes.object,
  };
  
  SsrDataProvider.childContextTypes = {
    data: React.PropTypes.object,
  };
  </code></pre>
  
  <p>In the server, window.<strong>INITIAL_STATE</strong> gets replaced with the actual data passed in through a prop:</p>
  
  <pre><code>renderToString(&lt;SsrDataProvider {...renderProps} data={data} /&gt;)
  </code></pre>
  
  <p>and the data provider renders the router context instead of children...</p>
  
  <pre><code>render() {
    return &lt;RouterContext {...this.props} /&gt;;
  }
  </code></pre>
  
  <p>The problem is that the context isn't defined during server rendering. It's like it was never passed in at all. Then when the javascript bundle arrives to the client it uses the window.<strong>INITIAL_STATE</strong> variable and picks up where the server left off. It works, but I might as well not do any server side rendering. Is there something I'm missing? or maybe renderToString() does not support context?</p>