頁面使用裝飾器 connect 會導致路由缺失(一般只要是Link這種跳轉,並且Route在當前頁面,就不會出現路由缺失。我出現的情況是當前頁面只有Link,控制檯打印this的時候 很明顯沒有history這個方法)
解決辦法:
使用withRouter包裹connect,實現跳轉的問題;
export default withRouter(connect()(App))
頁面使用裝飾器 connect 會導致路由缺失(一般只要是Link這種跳轉,並且Route在當前頁面,就不會出現路由缺失。我出現的情況是當前頁面只有Link,控制檯打印this的時候 很明顯沒有history這個方法)
解決辦法:
使用withRouter包裹connect,實現跳轉的問題;
export default withRouter(connect()(App))