Question · Vibe coding with Claude Code course · Module 3: Twitter clone

useRouter requires 'use client'

Why must a file using useRouter have 'use client' at the top?

Answer options

  • useRouter works only on the server
  • useRouter is a hook available only in a Client Component
  • 'use client' speeds up navigation
  • Without it Next.js deletes the file

You can check the correct answer by solving this task in the CodeWorlds game.