Check out redux-zero: A lightweight state container based on Redux
Send the initial state from the server
//Sending initial state from the server
const store = createStore({count: 4})
const componentString = renderToString(<App {...store}/>)
res.send(`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Redux Zero SSR Example</title>
</head>
<body>
<div id="root">${componentString}</div>
<script>window.__INITIAL_STATE__=${JSON.stringify(store.getState())}</script>
${assets}
</body>
</html>
`)
//Hyderate the client side store using the state sent from the server
const store = createStore(window.__INITIAL_STATE__)
hydrate(<App {...store}/>,document.getElementById('root'))
To run this example in
yarn start
yarn run start:prod