0

I'm working on a project using the new Next.JS app router, and I'm struggling to retrieve the URL slug.

In the original Page Router (next/router), it was this easy

const router = useRouter();
const {slug} = router.query;

But I can't seem to find an equivalent next/navigation. Does anyone know?

edit
  • 3
  • 3

1 Answers1

0

Just as I posted this I found the answer!

import {useParams} from 'next/navigation'

const {slug} = useParams();

edit
  • 3
  • 3