【发布时间】:2021-04-13 15:44:07
【问题描述】:
你好我正在尝试使用
this.history.push({
pathname: `/search-results`,
search: `${job}$${location}`
})
在我使用 type script 的类组件中。 但是,它给了我一个错误,即“横幅”类型上不存在属性“历史”。 TS2339
我可以看到其他功能组件的例子,你可以做const history = useHistory();并使用hook中的history.push。
如何在类组件中做同样的事情?
【问题讨论】: