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

I’m trying to get the latest redux state in getServerSideProps like this :

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 .

How can I get the latest persisted redux state in getServerSideProps next js ?

Answer

I Figured I could only access the latest redux states by only using the latest redux config for next js which is available here :

Next js redux example