Next.js Discord

Discord Forum

store or passing props from server to client

Answered
Southeastern blueberry bee posted this in #help-forum
Open in Discord
Southeastern blueberry beeOP
I was wondering why we use client side store for storing user session data instead of passing it from server component to client component ? For example Nextauth use the client store pattern with useSession()
Answered by B33fb0n3
you can either use jwt (clientside based) or sessions (serverside based). Both has pros and cons [(see attached)](https://media.geeksforgeeks.org/wp-content/uploads/20240723120808/Session-Based-Authentication-vs--JSON-Web-Tokens-(JWTs).webp). Both can be very good and both can be very bad. It depends on the enviorement where which strategie be used. So take a look at all pros and cons to check which one is the best for you
View full answer

2 Replies

@Southeastern blueberry bee I was wondering why we use client side store for storing user session data instead of passing it from server component to client component ? For example Nextauth use the client store pattern with useSession()
you can either use jwt (clientside based) or sessions (serverside based). Both has pros and cons [(see attached)](https://media.geeksforgeeks.org/wp-content/uploads/20240723120808/Session-Based-Authentication-vs--JSON-Web-Tokens-(JWTs).webp). Both can be very good and both can be very bad. It depends on the enviorement where which strategie be used. So take a look at all pros and cons to check which one is the best for you
Answer