Click in order · Next.js course · Module 2: Routing and Layouts

usePathname Syntax in a Component

Arrange the usePathname syntax in a component

Items to click

  • { usePathname }
  • import
  • 'use client'
  • 'next/navigation'
  • const pathname = usePathname()
  • from
Show the answer

Correct order:

  1. 'use client'
  2. import
  3. { usePathname }
  4. from
  5. 'next/navigation'
  6. const pathname = usePathname()