Skip to main content
Index

Force refresh page in Next.js

4/23/2025Preet Suthar1 min read

If you’re inside a React component, grab the router instance with the useRouter hook:

import { useRouter } from "next/router";

function MyComponent() {
  const router = useRouter();

  // reload the current page
  router.reload(window.location.pathname);
}

If you need to trigger a reload from outside a component—for example, in a plain utility module—just import the singleton Router instead:

import Router from "next/router";

// reload the current page
Router.reload(window.location.pathname);