-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.jsx
68 lines (65 loc) · 2.09 KB
/
Main.jsx
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { StrictMode } from "react";
import ReactDOM from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import AppLayout from "./src/App/AppLayout";
import Body from "./src/App/Body";
import Error from "./src/App/Error";
import BodyContentLayer from "./src/App/BodyContentLayer";
import ReactFetchGetApp from "./src/Projects/React-Fetch-Get/App";
import ReactFetchPostApp from "./src/Projects/React-Fetch-Post/App";
import ReduxCounterApp from "./src/Projects/Redux-Counter-App/App";
import ReactGoogleAuth from "./src/Projects/React-Google-Auth/App";
// call createBrowserRouter for routing different pages
const appRouter = createBrowserRouter([
{
path: "/", // show path for routing
element: <AppLayout />, // show component for particular path
errorElement: <Error />, // show error component if path is wrong
children: [
// show children component for routing
{
path: "/",
element: (
<BodyContentLayer>
<Body />
</BodyContentLayer>
), // All Projects are inside Body Component
},
{
path: "/redux-counter-app",
element: (
<BodyContentLayer>
<ReduxCounterApp />
</BodyContentLayer>
), // Redux Counter App Project
},
{
path: "/react-fetch-get",
element: (
<BodyContentLayer>
<ReactFetchGetApp />
</BodyContentLayer>
), // React HTTP Fetch Get App Project
},
{
path: "/react-fetch-post",
element: (
<BodyContentLayer>
<ReactFetchPostApp />
</BodyContentLayer>
), // React HTTP Fetch Post App Project
},
{
path: "/react-google-auth",
element: (
<BodyContentLayer>
<ReactGoogleAuth />
</BodyContentLayer>
), // React Google Auth Project
},
],
},
]);
const root = ReactDOM.createRoot(document.getElementById("root"));
// render RouterProvider and pass appRouter as props
root.render(<RouterProvider router={appRouter} />);