📜  反应路由在 url 中发送信息 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:22.295000             🧑  作者: Mango

代码示例1
// your route setup


// your link creation
const newTo = { 
  pathname: "/category/595212758daa6810cbba4104", 
  param1: "Par1" 
};
// link to the "location"
// see (https://reacttraining.com/react-router/web/api/location)
 

// In your Category Component, you can access the data like this
this.props.match.params.catId // this is 595212758daa6810cbba4104 
this.props.location.param1 // this is Par1