Skip to content

Commit e8c810c

Browse files
committed
fix(frontend): use Route inside Routes
1 parent b635866 commit e8c810c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/frontend/src/Routes.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { lazy, Suspense } from "react";
2-
import { Routes as ReactRouterRoutes } from "react-router-dom";
2+
import { Routes as ReactRouterRoutes, Route } from "react-router-dom";
33

44
const ListNotes = lazy(() => import("./content/ListNotes"));
55
const CreateNote = lazy(() => import("./content/CreateNote"));
@@ -10,10 +10,14 @@ const Routes = () => (
1010
<div className="mt-md-4 d-flex flex-column justify-content-center">
1111
<Suspense fallback={<div>Loading...</div>}>
1212
<ReactRouterRoutes>
13-
<ListNotes path="/" />
14-
<CreateNote path="/note/new" />
15-
<ShowNote path="/notes/:noteId" />
16-
<NotFound default />
13+
<Route path="/" element={<ListNotes />}>
14+
<Route index element={<ListNotes />} />
15+
<Route path="notes" element={<ListNotes />}>
16+
<Route path="new" element={<CreateNote />} />
17+
<Route path=":noteId" element={<ShowNote />} />
18+
</Route>
19+
<Route element={<NotFound />} />
20+
</Route>
1721
</ReactRouterRoutes>
1822
</Suspense>
1923
</div>

packages/frontend/src/content/ListNotes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const ListNotes = (props: any) => {
5555
));
5656

5757
const createNewNote = () => (
58-
<Link key="new" to="note/new">
58+
<Link key="new" to="notes/new">
5959
<Button variant="primary" block>
6060
Create a new note
6161
</Button>

0 commit comments

Comments
 (0)