I’m having an issue with the links used in Next.js.
The idea is that when I click on a link that has an ID, it should directly navigate to the sections containing that ID.
The problem is that when I click on one of the links that directs to “/conectate#…” , the link only takes me to the beginning of the page, and the ID is no longer present in the URL.
Steps to reproduce the problem:
In the menu, find the text “conectate”, which displays a menu, where you will find the links with ids
A dropdown menu will appear with options numbered according to the Next.js documentation. Components: <Link> | Next.js
Despite clicking on any of the options, all of them only take me to the beginning of the page and not to the corresponding section.
I would greatly appreciate any help to resolve this issue. Thank you!
There are numerous issues that need attention here.
The first problem occurs when a link is clicked, resulting in an unnecessary page reload, which should be avoided since Next works without a hard reload.
The second issue involves links with an ID that fail to direct users to the correct destination.
Lastly, when a new tab is opened, the specified ID in the URL correctly leads to the intended destination, but it doesn’t work on the same page.
Let’s collaborate to effectively address these problems.
I don’t believe the issue is originating from Next.js. You can verify this by checking out the Vercel deploy, where the problems I explained earlier do not exist.
Hello there! I recently encountered a problem with my Next.js 14 app. I found that the links were not working on Netlify, but they were working fine on Vercel. To fix this issue, I replaced the Next.js with a regular anchor tag <a,> . After redeploying the project, I was happy to see that it now works perfectly on Netlify. I believe the issue was caused by Netlify not supporting from Next.js.
I shared this because I like Netlify and thought it may help. Thanks for the great free hosting. Netlify is the best!