-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathRestaurantMenu.js
35 lines (31 loc) · 892 Bytes
/
RestaurantMenu.js
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
import React, { useEffect, useState } from "react"
import { useParams } from "react-router-dom"
import Shimmer from "./Shimmer"
import useRestaurantMenu from "../utils/useRestaurantMenu"
const RestaurantMenu = () => {
const param = useParams()
const { id } = param
const [restaurant, menu] = useRestaurantMenu(id)
return (
<div className="menu flex-container">
<div className="menu__restaurant">
<hr />
<h2>{restaurant.name + ", " + restaurant.city}</h2>
<hr />
</div>
<div className="menu__card">
<h3>Restaurant Menu</h3>
{menu?.length === 0 ? (
<Shimmer />
) : (
<ul>
{menu?.map((menuItem, index) => {
return <li key={index}>{menuItem?.card?.info?.name}</li>
})}
</ul>
)}
</div>
</div>
)
}
export default RestaurantMenu