@@ -25,35 +25,39 @@ const router = createBrowserRouter([
25
25
loader : rootLoader ,
26
26
action : rootAction ,
27
27
children : [
28
- { index : true , element : < Index /> } ,
29
28
{
30
- path : 'contacts/:contactId' ,
31
- element : < Contact /> ,
32
- loader : contactLoader ,
33
- action : contactAction ,
34
- } ,
35
- {
36
- path : 'contacts/:contactId/edit' ,
37
- element : < EditContact /> ,
38
- loader : contactLoader ,
39
- action : editAction ,
40
- } ,
41
- {
42
- path : 'contacts/:contactId/destroy' ,
43
- // element: <DeleteContact />,
44
- action : deleteAction ,
45
- errorElement : < div > Oops! There was an error.</ div > ,
46
- } ,
47
- {
48
- errorElement : < ErrorPage /> ,
29
+ errorElement : < Index /> ,
49
30
children : [
50
- { index : true , element : < Index /> } ,
51
31
{
52
32
path : 'contacts/:contactId' ,
53
33
element : < Contact /> ,
54
34
loader : contactLoader ,
55
35
action : contactAction ,
56
36
} ,
37
+ {
38
+ path : 'contacts/:contactId/edit' ,
39
+ element : < EditContact /> ,
40
+ loader : contactLoader ,
41
+ action : editAction ,
42
+ } ,
43
+ {
44
+ path : 'contacts/:contactId/destroy' ,
45
+ // element: <DeleteContact />,
46
+ action : deleteAction ,
47
+ errorElement : < div > Oops! There was an error.</ div > ,
48
+ } ,
49
+ {
50
+ errorElement : < ErrorPage /> ,
51
+ children : [
52
+ { index : true , element : < Index /> } ,
53
+ {
54
+ path : 'contacts/:contactId' ,
55
+ element : < Contact /> ,
56
+ loader : contactLoader ,
57
+ action : contactAction ,
58
+ } ,
59
+ ] ,
60
+ } ,
57
61
] ,
58
62
} ,
59
63
] ,
@@ -71,7 +75,9 @@ const router = createBrowserRouter([
71
75
action={rootAction}
72
76
errorElement={<ErrorPage />}
73
77
>
78
+ <Route errorElement={<ErrorPage />}>
74
79
{...child routes configurations}
80
+ </Route>
75
81
</Route>
76
82
)
77
83
)
0 commit comments