@@ -25,35 +25,39 @@ const router = createBrowserRouter([
2525 loader : rootLoader ,
2626 action : rootAction ,
2727 children : [
28- { index : true , element : < Index /> } ,
2928 {
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 /> ,
4930 children : [
50- { index : true , element : < Index /> } ,
5131 {
5232 path : 'contacts/:contactId' ,
5333 element : < Contact /> ,
5434 loader : contactLoader ,
5535 action : contactAction ,
5636 } ,
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+ } ,
5761 ] ,
5862 } ,
5963 ] ,
@@ -71,7 +75,9 @@ const router = createBrowserRouter([
7175 action={rootAction}
7276 errorElement={<ErrorPage />}
7377 >
78+ <Route errorElement={<ErrorPage />}>
7479 {...child routes configurations}
80+ </Route>
7581 </Route>
7682 )
7783 )
0 commit comments