Sharing User Data Between Server Components of Different Pages in Next.js 14 #67330
Unanswered
abuzain432432
asked this question in
App Router
Replies: 1 comment 1 reply
-
sharing-data-between-components The code looks like the following:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using Next.js 14 with the app router. In my main layout file, I am fetching user data using a server component and then sharing that data with a client component. I have a context provider that passes this data to the context, allowing me to easily access the user data across all client components on different pages.
However, I am facing an issue: while I can easily access the user data from the context in client components on all pages, I need to access this data in a few server components on other pages as well. How can I achieve this? Should I use cookies on the server side for this, or is there a better approach?
Beta Was this translation helpful? Give feedback.
All reactions