Next.js · Junior · Question 21 of 75

Where do you import useRouter from in the App Router?

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().

Further reading

Problem with a question

Next.js · Junior · question 21

Test yourself

Take the Next.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz