鍍金池/ 問答/HTML/ react-router4 如何傳遞參數(shù)

react-router4 如何傳遞參數(shù)

react-router4 如何傳遞參數(shù)

![圖片上傳中...]

clipboard.png

![圖片上傳中...]
使用動態(tài)路由后從this.props.location.state拿到的參數(shù)為undifind了,求解怎么樣正確的傳遞參數(shù)。

回答
編輯回答
熊出沒

history.push(path, {query: {grade, id}})
獲取的時候在match中。請把props打印出來慢慢找。

2017年7月29日 18:43
編輯回答
伴謊

參考我的文章
react-router4沒有this.props.history這樣的用法
傳遞參數(shù)可用eventproxy,或者父組件傳遞回掉函數(shù)實現(xiàn)

2017年4月26日 23:44