File tree 2 files changed +10
-6
lines changed 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
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" ;
3
3
4
4
const ListNotes = lazy ( ( ) => import ( "./content/ListNotes" ) ) ;
5
5
const CreateNote = lazy ( ( ) => import ( "./content/CreateNote" ) ) ;
@@ -10,10 +10,14 @@ const Routes = () => (
10
10
< div className = "mt-md-4 d-flex flex-column justify-content-center" >
11
11
< Suspense fallback = { < div > Loading...</ div > } >
12
12
< 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 >
17
21
</ ReactRouterRoutes >
18
22
</ Suspense >
19
23
</ div >
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ const ListNotes = (props: any) => {
55
55
) ) ;
56
56
57
57
const createNewNote = ( ) => (
58
- < Link key = "new" to = "note /new" >
58
+ < Link key = "new" to = "notes /new" >
59
59
< Button variant = "primary" block >
60
60
Create a new note
61
61
</ Button >
You can’t perform that action at this time.
0 commit comments