Next.js Discord

Discord Forum

What's the best way to share a big nested object between pages?

Fenriuz posted this in #help-forum
Open in Discord
I have a Nextjs application using app router and I need to share a big object with nested objects between different pages without losing server side rendering in my pages (I mean, I have client a few client side components but the pages and other inside are server side). This is data from unauthenticated users so I can't store in the database and link with the user because doesn't exist, what could be the best approach to do it?

I think in Context API but I need to wrap pages inside and that transform my pages in client side components, so I think maybe cookies could be but I'm talking about a big object with nested Objects (same if we use query params)... So I'm not sure, I would appreciate some of help, thanks.

0 Replies