#Active link without making it a client component

9 messages · Page 1 of 1 (latest)

compact escarp
#

Currently I am using the "usePathname" hook from "next/navigation" to check if I need the active class on a link. But this requires it to be a Client component.
Is there a way to check if the current link path without making it a client component?

vital crescentBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

warm robin
#

why do you have Link's that point to possibly non-existent paths?

#

in other words, what is the context of this question

steady panther
#

what's wrong with client components? active/inactive states of links are interactive client-side states so client components are the right tool for the job

compact escarp
#

Ok thanks

vital crescentBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer
odd shadow