Frontend
Frontend
DOCTYPE html>
<head>
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
export default {
theme: {
extend: {
fontFamily: {
},
daisyui: {
},
},
},
plugins: [require("daisyui")],
};
// App.js
import React, { useState, useEffect } from 'react';
function App() {
useEffect(() => {
axios.get('http://localhost:5000/menu')
}, []);
setOrder([...order, item]);
setTotal(total + item.price);
};
.then((response) => {
setOrder([]);
setTotal(0);
})
};
return (
<div>
<h2>Menu</h2>
<ul>
{menu.map((item) => (
<li key={item._id}>
{item.name} - ${item.price}
</li>
))}
</ul>
<h2>Your Order</h2>
<ul>
))}
</ul>
<p>Total: ${total}</p>
</div>
);