我在主要成分此鏈接如何獲得播放器組件值:如何在鏈路的路由器獲得童車值反應
<Link to="/player" params={{ testvalue: "hello" }}
className="btn">watch</Link>
class Player extends React.Component{
render(){
alert(this.params.testvalue);
return(
<div></div>
);
}
}
這是一個路由文件
<Route path="/" component={App}>
<IndexRoute component={main}/>
<Route path="/player" component={Player}/>
</Route>
爲了幫助你在將來使用這個參數,你可以看看在鉻上的反應devtool和你可以在鏈接中的所有道具只是一個提示 – EQuimper