Get Active Link from Server Component (Next.js 13.4)
I was making a basic Navigation for a Webpage. Since all React Components in Next 13.3 are by default Server Component if there a way to get the current page pathname from the server itself or do I have to use the 'use Client' and use the 'usePathname()'? I just want to highlight the active link in the navigation.
Currently, usePathname() is the recommended way according to the Docs: https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#checking-active-links
Routing: Linking and Navigating
Learn how navigation works in Next.js, and how to use the Link Component and
useRouter
hook.0 Replies