Current Order
-Total:
+-
+ {order.map((item, index) => {
+ return (
+
- + removeFromOrder(index)}>❌ + {item.name} + {item.price} + + ); + })} +
diff --git a/README.md b/README.md index 3b51cb1..5ba2378 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Edit multiple JavaScript files in this lab to refactor this app to have multiple 1. Deploy this application to Netlify and add the link to your netlify site below: -- [MY LIVE SITE URL]() +- [MY LIVE SITE URL](https://steady-mochi-a789fd.netlify.app/) #### Testing Tips diff --git a/src/App.jsx b/src/App.jsx index 0218d5b..7bc8360 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,19 +1,54 @@ import Footer from "./Footer"; import Header from "./Header"; +import { useState } from "react"; +import menuItems from "./data"; function App() { + const [order, setOrder] = useState([]); + function addToOrder(item) { + setOrder([...order, item]); + } + function removeFromOrder(index) { + let temp = order.slice(); + console.log(temp.splice(index, 1)); + console.log(temp); + setOrder(temp); + } return (