79344731

Date: 2025-01-10 05:56:24
Score: 1
Natty:
Report link
const pathname = usePathname();
<Link href={`${pathname}/locations`}>Hello</Link>

You should use the pathname to get the current path and append it to the new URL, as Link will navigate to the new URL directly without retaining the previous path.

Using Next Js 14 version

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Reemu Kothari