0

Is there any way to get the path in the next.js router without an id? When I use router.pathname I get a path like: "/product/id" Is there any way to get a path without th id: "/product" I can do it that way:

`/${pathname.split('/')[1]}` //  /product

but maybe there is a better way?

Lex2000
  • 155
  • 1
  • 1
  • 12
  • There's no other built-in way to retrieve it in Next.js, if that's what you're asking. It's all about string manipulation. – juliomalves Nov 12 '22 at 20:03

0 Answers0