// 使用 params 传参。还需要在 App.js 的传参路径 path 添加 /:id // 例如:}> import { useParams } from 'react-router-dom' function About () { const params = useParams() return (
About得到的参数 id 值为 {params.id}
) } export default About