Next.js Discord

Discord Forum

better approach for contexts in nextjs

Unanswered
American Chinchilla posted this in #help-forum
Open in Discord
American ChinchillaOP
So in order to use Context from react i have to mark component as "use client" which is not really optimal

but i dont really see other way than using Context in my app
scenario:
imagine a dashboard to manage guilds
you have a /dashboard to select which guild you want to manage
and then /dashboard/id to manage selected guild

to not fetch guilds each time they are needed i decided to make Context providers for all guilds and for selected guild is that good approach?

4 Replies

American ChinchillaOP
how does the unstable_cache work
Gull Terrier
i like this. just make sure to invalidate this cache if a new guild is entered/deleted/edited