import { useState } from "react"; import "./Product.css"; import { Link } from "react-router-dom"; const newList = [ { id: 11, name: "孙悟空", desc: "我家住在花果山", }, { id: 22, name: "胡图图", desc: "我家住在翻斗花园", }, { id: 33, name: "喜羊羊", desc: "我家住在青青草原", }, ]; function Product() { let [list] = useState(newList); return ( <> {list.map((item, index) => ( ))}
姓名 描述 操作
{item.name} {item.desc} {/*页面跳转伴随着参数的传递 参数传递? */} {/*1.路由传参 动态路由 跳转*/} {/* 去详情 */} {/* 2.查询参数 */} {/* 去详情 */} {/* 去详情 */} {/* 3.history 中路由传参 state传参*/} 去详情
); } export default Product;