# Error: NextRouter was not mounted.

**Code:** `NextRouter was not mounted` · **Category:** React · **Seen on:** React

next/router’s useRouter was used inside the App Router (app/ directory), which uses next/navigation instead.

## Meaning

The pages router and the App Router have different hooks. In app/ use useRouter, usePathname and useSearchParams from next/navigation.

## Common causes

- Importing useRouter from 'next/router' in app/
- Shared components used by both routers

## Quick fix

1. Import from 'next/navigation' in the App Router
2. Replace router.query with useSearchParams/useParams

## Detailed fix by platform

### React

1. `import { useRouter, usePathname } from 'next/navigation';`

## How to diagnose

1. **Router** — app/ or pages/?
2. **Import** — Which module?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/react/nextrouter-was-not-mounted)
