6

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.

Niranjan Rajesh
  • 85
  • 1
  • 1
  • 4

2 Answers2

8

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

4

Another solution to do hard reload on navigation/redirect in next.js is to use native browser location API, like this

function onClick() {
  window.location.href = "/destination"
}

<Link onClick={onClick}>link</Link>
artplan
  • 41
  • 1