I use the anchor tag in my next.js website because when I click on the anchor tag then I am going to the detail page when I click the back arrow then it's landed me on the exact location where I left the website (clicking on the anchor tag the whole website is reloaded ) if I used the link then it's not land me on the exact location how I can replace the anchor tag or used the link to land me on the exact location.
Asked
Active
Viewed 23 times
1
-
The full page reload when using the anchor tag is expected. You can add [`scroll={false}`](https://nextjs.org/docs/api-reference/next/link#disable-scrolling-to-the-top-of-the-page) when using `next/link` to prevent the scroll to top. See [Next.js maintain scroll position when page Routing](https://stackoverflow.com/questions/59606737/next-js-maintain-scroll-position-when-page-routing). – juliomalves Jun 08 '22 at 20:51