Next.js Discord

Discord Forum

Best way to handle this data between server and client components

Unanswered
Eurasian Hobby posted this in #help-forum
Open in Discord
Eurasian HobbyOP
I fetch some data which is used in a large number of components, both server and clientside.

This makes prop drilling pretty unusable due to how frequently this would happen.

As well as this fetching from the API every time is also a pain as I'll hit rate limits.

What is the best way of achieving this as I don't think a state management library which is what I'd normally use would help here as it would still result in two API calls, one from the server and one from the client for each page load.

2 Replies

export a function wrapped with unstable_cache and use that
Cape horse mackerel