Search code examples
reduxnext.jsreact-propsnext-redux-wrapper

pageProps vs props in nextjs


I looked at what nextjs returns when navigating the page and noticed that the state of hydration is duplicated on the page and transmitted in two different properties of the object: enter image description here I do not understand whether this is the norm of logic or whether it is not a duplication of logic.

I use next-i18next for multilingualism and next-redux-wrapper for hydration of redux storage on the server, and this is exactly the state it creates and is located in these two properties.

Therefore, when I noticed this, I wondered if this was normal logic, since my storage is not so small, and I would not like any extra operations when working on the server.

If you need more information, write in the comments.


Solution

  • It looks like the two set of props- pageProps and props are related to the loading of the Custom App component and the page component respectively. You can read about Custom App component here

    And as the doc states.

    pageProps is an object with the initial props that were preloaded for your page by one of our data fetching methods, otherwise it's an empty object.