Best practices for dynamic data page-related #12655
Unanswered
Vadorequest
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm wondering if there are best practices or experience feedback regarding how to handle data that are specific per-page, compared to data that are common to all pages.
Obviously, in any Next.js app, there are props shared across all pages (through getInitialProps, getStaticProps and getServerSideProps). Those data live in
props.pageProps
in_app.render
.Now, I have some data that are dynamic (fetched from an API/DB) and page-specific, such as:
props.pageProps.customer
object (needed in shared part of the app like head/footer)props.pageProps.products
array (display products)Right now, those data live in
props.pageProps
directly, but I wonder if some rules shouldn't be enforced, and if they shouldn't be rather available underprops.pageProps.data/pageData
("data" feels too-wide of a term, "pageData" feels somehow redundant)My concerns are:
Did you encounter those situations? How do you recommend to go about that?
Beta Was this translation helpful? Give feedback.
All reactions