useRouter

The hook from next/navigation that lets Client Components navigate and refresh in code.

In more detail

router.push('/login') navigates, router.back() goes back and router.refresh() re-fetches the current route from the server. It only works in Client Components.

Related terms

Taught in

References