-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathapp.tsx
41 lines (37 loc) · 853 Bytes
/
app.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { createBrowserRouter, Outlet, RouterProvider } from "react-router-dom";
import "./index.css";
import {
Fallback,
Layout,
RootErrorBoundary,
Project,
ProjectErrorBoundary,
projectLoader,
} from "./routes";
let router = createBrowserRouter([
{
path: "/",
element: <Layout />,
children: [
{
path: "",
element: <Outlet />,
errorElement: <RootErrorBoundary />,
children: [
{
path: "projects/:projectId",
element: <Project />,
errorElement: <ProjectErrorBoundary />,
loader: projectLoader,
},
],
},
],
},
]);
if (import.meta.hot) {
import.meta.hot.dispose(() => router.dispose());
}
export default function App() {
return <RouterProvider router={router} fallbackElement={<Fallback />} />;
}