From 1ef9a0289fd1900f0fcaa8414dbccf6cd5be93c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 24 Sep 2023 17:36:20 -0500 Subject: [PATCH] fix: use pathname instead --- src/app/tools/layout.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/tools/layout.tsx b/src/app/tools/layout.tsx index 07efc32a8..348899b48 100644 --- a/src/app/tools/layout.tsx +++ b/src/app/tools/layout.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useRouter } from 'next/navigation'; +import { usePathname } from 'next/navigation'; import { ReactNode } from 'react'; import { TOOLS } from '../../constants/tools'; import { theme } from '../../stitches.config'; @@ -10,8 +10,8 @@ interface ToolsLayoutProps { } export default function ToolsLayout({ children }: ToolsLayoutProps) { - const router = useRouter(); - const toolId = router.pathname.split('/').at(-1); + const pathname = usePathname(); + const toolId = pathname.split('/').at(-1); const tool = TOOLS.find((tool) => tool.id === toolId); return (