Using NavLink and Accordion, cannot see current active link #1529
-
I don't know if it's a bug or I'm missing something. Navigation is working well in my Gatsby site, using AccordionNav and NavLink as in the example. My code:
Thanks a lot for your work The only thing missing is that the link, after being clicked, is not seen as "active", therefore style isn't applied My package.json has: Should it work by default? Or this isn't something currently working? I can see that NavLink has this style:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey! While I've never used these components in exactly that way, my guess is you'll need to wrap |
Beta Was this translation helpful? Give feedback.
Hey! While I've never used these components in exactly that way, my guess is you'll need to wrap
NavLink
withLink
so you can custom-apply your active styling to it. We don't integrate with Gatsby/Next/etc links out of the box since this is just a styling library. Try making your ownGatsbyNavLink
component that checks if the link is active with Gatsby, then renders a child NavLink.