Check for authed user in the layout
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
Hey everyone 🤟
I just started with the new version of Nextjs and App router.
I want it know what is the best way to fetch authenticated user in the layout to show either the log in button or user menu in the Navigation component?
Navigation component is rendered inside the layout.tsx, because I need it on every page.
Currently I fetch it inside the layout.tsx directly, since it is a server component and it works locally, but will it also work in production? because as I understand server components can not rerender, and won't update the log in button section even after authentication, right
?
I just started with the new version of Nextjs and App router.
I want it know what is the best way to fetch authenticated user in the layout to show either the log in button or user menu in the Navigation component?
Navigation component is rendered inside the layout.tsx, because I need it on every page.
Currently I fetch it inside the layout.tsx directly, since it is a server component and it works locally, but will it also work in production? because as I understand server components can not rerender, and won't update the log in button section even after authentication, right
?