Next.js Discord

Discord Forum

How to keep active link style, when visit nested page?

Answered
Dwarf Hotot posted this in #help-forum
Open in Discord
Dwarf HototOP
app/dir, TailwindCSS, nested routes
There are a explanation, images of my problem here - https://github.com/wongprom/test-next-13/issues/13
Answered by Sun bear
Instead of currentRoute === url, check for currentRoute.startsWith(url)
View full answer

4 Replies

Sun bear
Instead of currentRoute === url, check for currentRoute.startsWith(url)
Answer
Dwarf HototOP
Thanks @Sun bear Got to work with your suggestion. If I can get your Github username I will thank you on my Github issue page - https://github.com/wongprom/test-next-13/issues/13
Sun bear
It's alright, you don't have to 😛 but if you want to, it's https://github.com/Dragory/
Dwarf HototOP
🤣 I got you👍