Here the link for the code: <a href="https://codesandbox.io/s/react-how-do-i-display-specific-data-from-json-that-fullfill-a-condition-forked-z37eu1?file=/src/Button.jsx"> code_link</a> (go to /menu/Menu1/ click on Pea Soup for example.
<pre> export default function MenuDisplay() { const { menuId, itemId } = useParams(); const { match } = JsonData; const matchData = match.find((el) => el._id_menu === menuId)?._ids ?? []; const item = matchData.find((el) => el._id === itemId); return ( <> <h1>Menu Item</h1> <div> <div className="TextStyle"> Name : <button> {item.name} </button> </div> <div className="TextStyle">Description: {item.description} </div> <div className="TextStyle">Description: {item.price} </div> <div className="TextStyle"> Price : {item.taste} </div> <div className="TextStyle"> Comments : {item.comment} </div> </div> </> ); }
Here a picture to get the idea: <a href="https://imgur.com/a/YYeDd7O">image_link</a>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)