odin-codespace/shopping-cart/src/App.jsx

19 lines
460 B
React
Raw Normal View History

2024-10-11 16:38:38 -04:00
import { useState } from "react";
2024-10-13 11:41:36 -04:00
import { Outlet, useParams } from "react-router-dom";
2024-10-11 16:38:38 -04:00
import Main from "./components/main";
2024-10-13 11:41:36 -04:00
import "./App.css";
2024-10-11 16:38:38 -04:00
import Navbar from "./components/navbar";
function App() {
2024-10-13 11:41:36 -04:00
const { path } = useParams();
const [cartItems, setCartItems] = useState(0);
2024-10-11 16:38:38 -04:00
return (
<>
2024-10-13 11:41:36 -04:00
<Navbar cartItems={cartItems} />
{path === "cart" ? <Outlet /> : path === "store" ? <Outlet /> : <Main />}
2024-10-11 16:38:38 -04:00
</>
);
}
export default App;