Using server data on the client with Suspense #68554
Unanswered
ldhwaddell
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am struggling to find the best patterns for dealing with client components that require data fetched from the server.
Suppose I had a page with multiple components that require data. I want to use the features Next.js provides and fetch the data on the server with an
asynccomponent. I could do something like the example below, however then the user must wait for all the data fetching to complete before they can be shown the page.If I want to make this more user friendly and add
Suspensethen my understanding is that I would need to build something like:and then use it like:
This however quickly gets messy and can double the amount of components I am required to create and maintain. I have tried creating something generic like:
With this I find dealing with props can be difficult and it does not extend the best to different types of components.
Is there a more natural solution to passing this data around without having to wait for all queries in one spot?
Beta Was this translation helpful? Give feedback.
All reactions