1
我傳遞一個道具反應路線組件如下所列:陣營:道具不會顯示在陣營組件
<Route exact
path='/'
component={HomePage}
display_notification={this.display_notification.bind(this)}
/>
但是當我打印首頁的道具我找不到display_notification。
請幫忙。
我使用的反應路由器-V4
,但如果我這樣做,比我無法在組件使用道具訪問的位置。 – sam23
他們到達作爲參數傳遞給渲染FUNC - 所以'{道具=><首頁富= {} props.bar通知= {} this.blah />' –
@ sam23,你需要用與withRouter您的組件,檢查了這問題https://stackoverflow.com/questions/44127739/programatically-routing-based-on-a-condition-with-react-router/44128108#44128108 –