-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
46 lines (44 loc) · 1.13 KB
/
App.js
File metadata and controls
46 lines (44 loc) · 1.13 KB
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
import React from "react"
import ReactDOM from "react-dom/client"
import Header from "./components/Header"
import Body from "./components/Body"
import { createBrowserRouter, RouterProvider, Outlet } from "react-router-dom"
import About from "./components/About"
import Contact from "./components/Contact"
import Error from "./components/Error"
import RestaurantMenu from "./components/RestaurantMenu"
const AppLayout = () => {
return (
<div className="app">
<Header></Header>
<Outlet></Outlet>
</div>
)
}
const appRouter = createBrowserRouter([
{
path: "/",
element: <AppLayout></AppLayout>,
children: [
{
path: "/",
element: <Body></Body>,
},
{
path: "/about",
element: <About></About>,
},
{
path: "/contact",
element: <Contact></Contact>,
},
{
path: "/restaurants/:resId",
element: <RestaurantMenu></RestaurantMenu>,
},
],
errorElement: <Error></Error>,
},
])
const root = ReactDOM.createRoot(document.getElementById("root"))
root.render(<RouterProvider router={appRouter}></RouterProvider>)