Search code examples
reactjsroutesnext.jsnext-routernext-link

How to trigger hard refresh when redirecting to a different page in Next.js?


I have a <Link> to a certain page on my Next.js website. Upon clicking it, I want the webpage to hard reload after it redirects to the destination page (whether it reloads before or after the redirect is not important). I have tried using router.push as well but a hard refresh does not occur. Any help would be appreciated.


Solution

  • If you want to refresh the page on load use simple anchor tags, if you want more control over reloading the page, Refer this: https://nextjs.org/docs/api-reference/next/router#routerreload