React: Server-side rendering and hot reloading
Justin Jung
51315

Really great post! I’ve been looking through quite a few universal boilerplates recently and this article help explains how everything works together.

There’s only one main difference I’ve noticed. Most, if not all, examples I’ve seen so far would pass the initial redux store along in a variable that’s loaded into the DOM in a script tag, with some thing like __INITIAL_STATE__, resulting in the entire store being visible in the rendered DOM and passing it through to a new store in the client with something like

const preloadedState = window.__PRELOADED_STATE__
const store = configureStore(preloadedState)

In your example, it looks like you create two separate stores…is the redux store in the client getting the info from the pre-rendered store from the server?

Like what you read? Give Tom Ellwood a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.