Video wird geladen...
Video konnte nicht geladen werden
New Recipe: "Sharing data with Client Components" Learn how to use promises to unblock your page so it can be rendered (or even prerendered) as early as possible. Hope you enjoy!
18,841 Aufrufe • vor 10 Monaten •via X (Twitter)
13 Kommentare

🧑🍳

Great Sam, this pattern can be used for sharing page date to layouts as well cache from react

There we go! Hello Next Recipes 👋

This is the best way I’ve seen this explained so far. Nice job.

@aurorascharff Love the direction with Cache Components and "use cache". But enabling it wraps all routes in <Activity>, meaning routes no longer unmount. We have hundreds of forms and route-level state that rely on unmounting to reset, which is a blocker. Please let us opt out og this!

Looks great ! Thanks for the explainer

How does this work with pre-fetching? If I have a <Link preload={true}> to another page, and that page's tree has a client component wrapped in <Suspense> that calls the hook from your example, does NextJS know to pre-fetch the same way it would if I called getCurrentUser() from a server component?

Yep, since it’s still the server component providing the data during render 👍

great article thanks!

Thanks

Nextjs is still alive?

It wasn't obvious to me that this recipe would be compatible with cacheComponents. Pretty cool that it seems to be

Absolutely is!

