Passing async data to server components
hey guys.
I have a basic question - I'm fetching some "slow" data in a server component (at the page level).
There are several components on the page that depend on it, so I'm currently
await
ing that data, but obviously it means I have to wait before I get anything.
What's the best way to split this up so I can use suspense
? Is it to await getSlowData()
in every one of the components that requires it, and use unstable_cache
to make sure it's deduped? Or should I be doing const slowDataPromise = getSlowData()
and have the child components await the promise passed as a prop?
Or (hopefully but unlikely) I’ve missed some built in way of doing this succinctly?0 Replies