Skip to content

Commit 50c66b2

Browse files
committed
Implement custom 404 page
1 parent c74cf85 commit 50c66b2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/app/not-found.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { PacmanLoader } from "react-spinners";
2+
3+
export function NotFound() {
4+
return (
5+
<div className="flex h-screen flex-col items-center justify-center space-y-4">
6+
<PacmanLoader color="#2196f3" />
7+
<p>Not found.</p>
8+
</div>
9+
);
10+
}

src/router.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { Converter } from "./app/converter";
22
import { Home } from "./app/home";
3+
import { NotFound } from "./app/not-found";
34
import { Route, Routes } from "react-router";
45

56
export default function AppRouter() {
67
return (
78
<Routes>
89
<Route path="/" element={<Home />} />
910
<Route path="/converter" element={<Converter />} />
11+
12+
{/* Fall back on app's 404 page. This is because of the SPA routing trick with 404.html used in GitHub Pages. */}
13+
<Route path="*" element={<NotFound />} />
1014
</Routes>
1115
);
1216
}

0 commit comments

Comments
 (0)