Skip to content

Commit 92b5bda

Browse files
committed
Add not found
1 parent 20993ce commit 92b5bda

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

examples/react/todo/app.config.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Link } from "@tanstack/react-router"
2+
3+
export function NotFound() {
4+
return (
5+
<div className="min-h-screen flex items-center justify-center bg-gray-50">
6+
<div className="max-w-md w-full bg-white rounded-lg shadow-lg p-8 text-center">
7+
<div className="text-6xl font-bold text-gray-300 mb-4">404</div>
8+
<h1 className="text-2xl font-bold text-gray-800 mb-4">
9+
Page Not Found
10+
</h1>
11+
<p className="text-gray-600 mb-8">
12+
The page you're looking for doesn't exist or has been moved.
13+
</p>
14+
15+
<div className="space-y-4">
16+
<Link to="/" className="block w-full">
17+
<button className="w-full px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">
18+
Go Home
19+
</button>
20+
</Link>
21+
22+
<div className="flex space-x-4">
23+
<Link to="/query" className="flex-1">
24+
<button className="w-full px-4 py-2 bg-green-100 text-green-700 rounded-lg hover:bg-green-200 transition-colors text-sm">
25+
Query Demo
26+
</button>
27+
</Link>
28+
<Link to="/electric" className="flex-1">
29+
<button className="w-full px-4 py-2 bg-blue-100 text-blue-700 rounded-lg hover:bg-blue-200 transition-colors text-sm">
30+
Electric Demo
31+
</button>
32+
</Link>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
)
38+
}

examples/react/todo/src/router.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createRouter as createTanstackRouter } from "@tanstack/react-router"
22

33
// Import the generated route tree
44
import { routeTree } from "./routeTree.gen"
5+
import { NotFound } from "./components/NotFound"
56

67
import "./styles.css"
78

@@ -11,6 +12,7 @@ export const createRouter = () => {
1112
routeTree,
1213
scrollRestoration: true,
1314
defaultPreloadStaleTime: 0,
15+
defaultNotFoundComponent: NotFound,
1416
})
1517

1618
return router

0 commit comments

Comments
 (0)