-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.jsx
67 lines (64 loc) · 1.97 KB
/
index.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
import ReactDOM from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import App from "./src/App/App";
import Body from "./src/App/Body";
import Error from "./src/App/Error";
import BodyLayout from "./src/App/BodyLayout";
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: <App />, // show component for particular path
errorElement: <Error />, // show error component if path is wrong
children: [
// show children component for routing
{
path: "/",
element: (
<BodyLayout>
<Body />
</BodyLayout>
), // All Projects are inside Body Component
},
{
path: "/redux-counter-app",
element: (
<BodyLayout>
<ReduxCounterApp />
</BodyLayout>
), // Redux Counter App Project
},
{
path: "/react-fetch-get",
element: (
<BodyLayout>
<ReactFetchGetApp />
</BodyLayout>
), // React HTTP Fetch Get App Project
},
{
path: "/react-fetch-post",
element: (
<BodyLayout>
<ReactFetchPostApp />
</BodyLayout>
), // React HTTP Fetch Post App Project
},
{
path: "/react-google-auth",
element: (
<BodyLayout>
<ReactGoogleAuth />
</BodyLayout>
), // React Google Auth Project
},
],
},
]);
const root = ReactDOM.createRoot(document.getElementById("root"));
// render RouterProvider and pass appRouter as props
root.render(<RouterProvider router={appRouter} />);