title: How to load initial data from rails to redux
body: <p>I tried to load json from rails, and pass it to redux createStore.</p>
  
  <pre><code>let initialStore = window.INITIAL;
  
  const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
  const store = createStoreWithMiddleware(rootReducer, initialStore);
  </code></pre>
  
  <p>But i always get undefined, or just window.INITIAL return value after store.</p>
  
  <p>At first, store loads with empty object, then fetch action is dispatched, and i get updated store with json, but i already got error, when i'm trying to call something like { product.title } on empty object. No matter what I do, i can't load json before redux stuff begins, even with global data, like this.</p>
  
  <pre><code>(function() {
    $.getJSON('http://localhost:3000/products.json', function(data) {
      return window.INITIAL = data;
    });
  });
  </code></pre>
  
  <p>Api and controller is simple.</p>
  
  <pre><code>def index
    products = Product.all
    render json: products
  end
  </code></pre>
  
  <p>How do you handle this? I want to do it without any gems like react-rails etc, i can't pass all initial state to Root component in one place.</p>