Check out the new NEXTUI navbar I'm using:
I am having trouble setting the isActive
property on the active link in my NavBar component in Next.js. I couldn't find much help on Google, so I'm hoping someone here has experience with this or knows how to do it.
Here is a snippet of the code:
<Navbar.Content
enableCursorHighlight
activeColor="primary"
hideIn="xs"
variant="highlight-rounded"
>
{navigation.map((item, index) => (
<Navbar.Link key={index} href={item.link}>
{item.title}
</Navbar.Link>
))}
</Navbar.Content>
UPDATE: When I try adding isActive
within the map
loop, it affects all links. What I want is to set isActive
for the clicked (active) link only. If I don't use a loop for my nav links (which are dynamic), I can set IsActive
for one link but then that single link remains active even if I click on other links.