From ebbcdc2089fc5afed880810bfb34df296ce45f05 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:33:34 -0500 Subject: [PATCH] fix: use useRouter instead of location --- src/app/tools/layout.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/tools/layout.tsx b/src/app/tools/layout.tsx index d371d7609..a0f652660 100644 --- a/src/app/tools/layout.tsx +++ b/src/app/tools/layout.tsx @@ -1,5 +1,6 @@ 'use client'; +import { useRouter } from 'next/router'; import { ReactNode } from 'react'; import { TOOLS } from '../../constants/tools'; import { theme } from '../../stitches.config'; @@ -9,7 +10,8 @@ interface ToolsLayoutProps { } export default function ToolsLayout({ children }: ToolsLayoutProps) { - const toolId = location.pathname.split('/').at(-1); + const router = useRouter(); + const toolId = router.pathname.split('/').at(-1); const tool = TOOLS.find((tool) => tool.id === toolId); return (