使用React Router V4以編程方式導航 - Programmatically navigate using react router V4

問題:

I have just replaced react-router from v3 to v4.我剛剛從v3到v4替換了react-router
But I am not sure how to programmatically navigate in the member function of a Component .但是我不確定如何以編程方式導航Component的成員函數。 ie in handleClick() function I want to navigate to /path/some/where after processing some data.即在handleClick()函數中,我想在處理一些數據後導航到/path/some/where I used to do that by:我曾經通過以下方式做到這一點:

import { browserHistory } from 'react-router'
browserHistory.push('/path/some/where')

But I can't find such interfaces in v4.但是我在v4中找不到這樣的接口。
How can I navigate using v4?如何使用v4導航?


解決方案:

參考一: https://en.stackoom.com/question/2qkBR
參考二: https://stackoom.com/question/2qkBR
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章