为了解决客户端和服务端 store的统一
<body>
<div id="root">${content}</div>
<script >
window.context = {
state: ${JSON.stringify(store.getState())}
}
</script>
<script src="index.js"></script>
</body>
export const getStore = () => {
return createStore(reducer,applyMiddleware(thunk))
};
export const getClientStore = () => {
const defaultState = window.context.state;
return createStore(reducer, defaultState, applyMiddleware(thunk))
};