Next.js Discord

Discord Forum

NextAuth - use await auth() in all components that need it or pass it down as props?

Unanswered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Saltwater CrocodileOP
Let's say

My header needs to know if a user is logged in

My homepage needs to know if a user is logged in

My footer doesn't need to know if a user is logged in

Do I:

1. use const session = await auth(); in all components/page that need it
1. use const session = await auth(); in RootLayout and pass it down as props to Header and children?

0 Replies