TS2739 Type is missing the following properties from type Readonly history locat

760 阅读1分钟

image.png 解决方案:

引入 withRouter,将组件包裹

目的就是让被修饰的组件可以从属性中获取history,location,match,

路由组件可以直接获取这些属性,而非路由组件就必须通过withRouter修饰后才能获取这些属性了