Next.js Discord

Discord Forum

A question about efficently using user id/information in server side functions

Unanswered
Broad-billed Hummingbird posted this in #help-forum
Open in Discord
Avatar
Broad-billed HummingbirdOP
Hello, hope everyone's doing well.
What i'm trying to do is to move certain client side functions i have to serverside but i'm not sure how to retreive and use userid and information as parameters for functions i'm calling inside the getserversideprops for example. What i did before was have a normal client function that i call inside useeffect and i use a usercontext to get relevant information about user that i stored. How would you recommend me to do this ? Also for my authentication i use a jwt should i just directly store and retreive userinformation from the jwt payload ? Even though that sounds a bit repetitive since i will have to decode my jwt everytime i need it.

0 Replies