title: redux store out of sync store().getState() with state from redux logger
body: <p>I have problem with redux store in SSR react app. Everything working great, initialState creating on server received by window.initialState on client. Problem starting when I whant to get current store by store().getState in my App.js</p>
  
  <p><strong>createStore.js</strong></p>
  
  <pre><code>const configureStore = preloadedState =&gt; {
  
      const store = createStore(
          rootReducer,
          preloadedState || global.__initialData__,
          applyMiddleware(
              promiseMiddleware(),
              thunk,
              // logger
          )
      );
  
      if (module.hot) {
          // Enable Webpack hot module replacement for reducers
          module.hot.accept('./reducers', () =&gt; {
              const nextRootReducer = require('./reducers/index');
              store.replaceReducer(nextRootReducer);
          });
      }
      return store;
  }
  
  export default configureStore;
  </code></pre>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>const stores = createStore( reducers );
  stores.dispatch(setLang( serve_lang )); // 'pl'
  global.__initialData__ = stores.getState();
  let initialDatas = stores.getState();
  const store = configureStore( initialDatas );
  ...
  &lt;html&gt;
  &lt;script&gt;window.__initialData__ = ${serialize(initialDatas)}&lt;/script&gt;
  ...
  </code></pre>
  
  <p><strong>client.js</strong></p>
  
  <pre><code> const store = configureStore(window.__initialData__);
  
      hydrate(
        &lt;Provider store={store} key={Math.random()}&gt;
          &lt;BrowserRouter&gt;
            &lt;App /&gt;
          &lt;/BrowserRouter&gt;
      &lt;/Provider&gt;,
    document.getElementById('root')
      );
  
      if (module.hot) {
        module.hot.accept();
      }
  </code></pre>
  
  <p>and in my App.js I want to get my current store by</p>
  
  <pre><code>import store from 'configureStore'l
  store().getState();
  </code></pre>
  
  <p><strong>and I always have initialState</strong> when I do store.getState() in App.js</p>
  
  <p><a href="https://i.stack.imgur.com/8cY5D.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8cY5D.jpg" alt="enter image description here"></a></p>