How to make protected routes in nextjs appdir
Hello! So I’m doing authentication and I want to make it so I fetch the user data on first load, but then reuse this data to check on all protected pages. How do I go about this? .
I thought about fetching this data each time they go to protected routes but isn’t that ineffective (spends more time)
I thought about fetching this data each time they go to protected routes but isn’t that ineffective (spends more time)
Solution
Hello! So I’m doing authentication and I want to make it so I fetch the user data on first load, but then reuse this data to check on all protected pages. How do I go about this? .
I thought about fetching this data each time they go to protected routes but isn’t that ineffective (spends more time)
I thought about fetching this data each time they go to protected routes but isn’t that ineffective (spends more time)