General question on architecture as it relates to client components as children
Answered
Spectacled bear posted this in #help-forum
Spectacled bearOP
So if I understand things correctly, it's very possible/normal to potentially have lots of awaited fetch calls at the page.tsx level, that are then passed down to children as props?
Only reason I ask was that I was fetching data in a server component. I then tried to import that server component into a client component, and got a warning about
I guess my only thinking now is, couldn't that lead to the potential for lots of awaited fetch calls at the page level?
I have a dashboard (homepage) and it has a few different components, some client, some server. Is the right way to architect this to have any data that any of that page's children components need fetched on the
Only reason I ask was that I was fetching data in a server component. I then tried to import that server component into a client component, and got a warning about
async/await not allowed in client components, assuming that meant the async server component I imported.I guess my only thinking now is, couldn't that lead to the potential for lots of awaited fetch calls at the page level?
I have a dashboard (homepage) and it has a few different components, some client, some server. Is the right way to architect this to have any data that any of that page's children components need fetched on the
page.tsx server component?Answered by riský
the only way of passing a server component to client is, through props or server action. if you have lots of slow things, you can use suspense and add loading state
1 Reply
the only way of passing a server component to client is, through props or server action. if you have lots of slow things, you can use suspense and add loading state
Answer