TS2739 Type is missing the following properties from type Readonly history location match

工程中報如下錯誤:

解決方案:

引入 withRouter,將組件包裹

目的就是讓被修飾的組件可以從屬性中獲取history,location,match,

路由組件可以直接獲取這些屬性,而非路由組件就必須通過withRouter修飾後才能獲取這些屬性了

 

發佈了99 篇原創文章 · 獲贊 45 · 訪問量 27萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章