Global data fetching
Using non-app directory Next.js 13 (latest T3), how do you go about fetching data to be consumed globally? Since
_app.tsx
doesn't allow using getServerSideProps
or getStaticProps
?6 Replies
react query with custom hook
so any place that call
useProfile
will get the same dataThis makes sense for client-side data fetching but what if I needed the data already on server side to populate the pages / components before getting the response back?
You can use something like get server side props
And the whole next props mess
You can't use gSSP / gSP in
_app.tsx
(where one could pass data down to children or store it in global state for everyone to consume)for global static data across entire app, one real option is just put it in a .json and import it wherever its needed
what do you mean by "consumed globally"?