Put in order · Next.js course · Module 2: Routing and Layouts
Importing and Using useRouter
Arrange the import and usage syntax of the useRouter hook
Items to put in order
- = useRouter()
- const router
- import { useRouter }
- from 'next/navigation'
Show the answer
Correct order:
- import { useRouter }
- from 'next/navigation'
- const router
- = useRouter()