// src/App.jsx import { BrowserRouter, Routes, Route, Link, useParams } from "react-router-dom"; const products = [ { id: "1", name: "Keyboard", price: 49.99 }, { id: "2", name: "Mouse", price: 19.99 }, { id: "3", name: "Monitor", price: 199.99 }, ]; function ProductListPage() { return ( ); } function ProductDetailPage() { const { id } = useParams(); const product = products.find((p) => p.id === id); if (!product) { return

Product not found.

; } return (

{product.name}

${product.price}

); } function App() { return ( } /> } /> ); } export default App; /* Notes: - useParams() reads the :id segment out of the URL as a string — note product.id in the array is also a string ("1") so the comparison in .find() lines up correctly. - Each product's Link carries its own id into the URL, so ProductDetailPage always knows exactly which product to show. */