on-internet
← Community

Anchor Tag in Next.js

Stack Overflow ·

I'm trying to use an anchor tag in Next.js. I don't get any console errors when I set it up and click the link, but the page does not jump to the element with indicated id property. This issue on GitHub suggests that people need to write a lot of custom code to use anchors. That can't be right. I have: const links = [ { label: 'Solutions', href: '#solutions', id: 'solutions' }, ]; <NavLink.Desktop key={index} href={link.href} id={link.id}> {link.label} </NavLink.Desktop> I get no errors, but the page does not jump to the label that has an id of 'solutions'. Does anyone know how to solve this,

Comments

Sign in or sign up to comment and upvote.

No comments yet.