useRouter get the route value
Unanswered
Northeast Congo Lion posted this in #help-forum
Northeast Congo LionOP
useRouter get the route value like course/[id] instead of course/1
In Next < 13, we can do this using router.pathname. How can I do this in NextJS 13?
In Next < 13, we can do this using router.pathname. How can I do this in NextJS 13?
5 Replies
Giant panda
Have you tried searching "pathname" in the docs?
Or read the docs about dynamic routes?
see if this is what you are looking for
import { usePathname } from 'next/navigation'
import { usePathname } from 'next/navigation'
Northeast Congo LionOP
desired output when log is course/[id]