From 29e184598cf9f30c8c077b5e90d93a6ff04c3e90 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Mon, 17 Jun 2024 13:04:41 +0700 Subject: [PATCH] fix: do not re-create router on each app re-render --- frontend/src/App.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 63434df7..d1b03f9d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -6,11 +6,11 @@ import { usePosthog } from "./hooks/usePosthog"; import { Toaster } from "src/components/ui/toaster"; import routes from "src/routes.tsx"; +const router = createHashRouter(routes); + function App() { usePosthog(); - const router = createHashRouter(routes); - return ( <>