[英]How to access updated redux store state in getServerSideProps next js?
I'm trying to get the latest redux state in getServerSideProps like this:我正在尝试在 getServerSideProps 中获取最新的 redux state,如下所示:
export const getServerSideProps = async (ctx) => {
const state = store.getState();
console.log(state.name);
return { props: { login: false } };
};
But the result I get is the initial name state.但我得到的结果是初始名称 state。
How can I get the latest persisted redux state in getServerSideProps next js?如何在 getServerSideProps next js 中获取最新的持久化 redux state?
I Figured I could only access the latest redux states by only using the latest redux config for next js which is available here:我想我只能通过为下一个 js 使用最新的 redux 配置来访问最新的 redux 状态,该配置可在此处获得:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.