页面使用装饰器 connect 会导致路由缺失(一般只要是Link这种跳转,并且Route在当前页面,就不会出现路由缺失。我出现的情况是当前页面只有Link,控制台打印this的时候 很明显没有history这个方法)
解决办法:
使用withRouter包裹connect,实现跳转的问题;
import {
NavLink,
withRouter
} from "react-router-dom"
export default withRouter(connect()(App))