Skip to content

Commit 1b258f7

Browse files
committed
feat: Add custom 404 not found component to enhance user experience
1 parent a5b57a8 commit 1b258f7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/routes/__root.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ export const Route = createRootRouteWithContext<MyRouterContext>()({
4949
],
5050
}),
5151

52+
notFoundComponent: () => {
53+
return (
54+
<div className="flex min-h-screen flex-col items-center justify-center gap-4 p-4">
55+
<h1 className="text-4xl font-bold">404</h1>
56+
<p className="text-muted-foreground">Page not found</p>
57+
<a
58+
href="/"
59+
className="text-primary underline underline-offset-4 hover:text-primary/80"
60+
>
61+
Go back home
62+
</a>
63+
</div>
64+
);
65+
},
66+
5267
shellComponent: RootDocument,
5368
});
5469

0 commit comments

Comments
 (0)