From 9389f23ad7d37c8ad2e5574a240db6b048eec612 Mon Sep 17 00:00:00 2001 From: Ou Date: Sat, 5 Oct 2024 02:36:54 +0800 Subject: [PATCH] feat: 404 auto redirect to / --- src/routes/__root.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index 8a9bfd2..8d38378 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -12,9 +12,18 @@ export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({ component: RootComponent, + notFoundComponent: NotFoundComponent, }) -export function RootComponent() { +function NotFoundComponent() { + const nav = Route.useNavigate() + nav({ + to: "/", + }) + return
+} + +function RootComponent() { useOnReload() return (