Answer the question
In order to leave comments, you need to log in
Loading data in Server side rendering?
I want to get data with SSR on Nextjs and save it to the redux state, through the getInitialProps dispatch action, it works, but the page comes to the browser without a state, how to forward the state from the server to the client?
Or is it impossible and props should be immediately substituted into the template?
What is the best way to work with getInitialProps in Nextjs
Index.getInitialProps = async ({ reduxStore }) => {
reduxStore.dispatch(initialize());
return { };
};
Answer the question
In order to leave comments, you need to log in
Suddenly someone will come in handy - you need to wait for the result of the executiondispatch
Index.getInitialProps = async ({ reduxStore }) => {
await reduxStore.dispatch(initialize());
return { };
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question