簡體   English   中英

如何在getServerSideProps next js中訪問更新的redux store state?

[英]How to access updated redux store state in getServerSideProps next js?

我正在嘗試在 getServerSideProps 中獲取最新的 redux state,如下所示:

export const getServerSideProps = async (ctx) => {
    const state = store.getState();
    console.log(state.name);

    return { props: { login: false } };
};

但我得到的結果是初始名稱 state。

如何在 getServerSideProps next js 中獲取最新的持久化 redux state?

我想我只能通過為下一個 js 使用最新的 redux 配置來訪問最新的 redux 狀態,該配置可在此處獲得:

下一個 js redux 例子

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM