# How to force a page refresh in Next.js

> Learn how to force a full page refresh in Next.js with the useRouter hook and router.reload(), or the imported Router object when you are outside a component.

Author: Flavio Copes | Published: 2021-05-09 | Canonical: https://flaviocopes.com/nextjs-force-page-refresh/

In a component, you can use the `useRouter` hook:

```js
import { useRouter } from 'next/router'

//...

const router = useRouter()

router.reload(window.location.pathname)
```

Sometimes you can't, for example when you're not in a [React](https://flaviocopes.com/react/) component, maybe in a utility function.

In that case, you can do this:

```js
import Router from 'next/router'

Router.reload(window.location.pathname)
```
