Thanks for the article! I have 2 questions? 1) When is best place to fetch the data to hydrate the components? On initializeStore or how can I access to store(in server) in getServerSideProps? 2) Is possible to persist the userStore for example to avoid auth fetch in each request, or is needed to refresh the store(in server)?
Depends what you want to do, if you have static rendering, than you need to hydrate the data on the server (when static page is built). You should not access the store in getServerSideProps rather you should just return data that will later be used do populate stores - passed to the root store provider by the page component.
I'm not really sure what you mean.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the article! I have 2 questions? 1) When is best place to fetch the data to hydrate the components? On initializeStore or how can I access to store(in server) in getServerSideProps? 2) Is possible to persist the userStore for example to avoid auth fetch in each request, or is needed to refresh the store(in server)?
getServerSideProps
rather you should just return data that will later be used do populate stores - passed to the root store provider by the page component.