Next.js · Junior · Question 21 of 75
Where do you import useRouter from in the App Router?
- ✓Correct answer:
next/navigation - 2
next/router - 3
react-router-dom
Explanation
In the App Router, navigation hooks - useRouter, usePathname, useSearchParams, useParams - are imported from next/navigation and work in client components. next/router is the Pages Router API. For a server-side redirect, use redirect().