react-router-dom with TypeScript

前端 未结 7 733
清歌不尽
清歌不尽 2021-01-30 19:56

I\'m trying to use react router with TypeScript. However, I have certain problems using withRouter function. On the last line, I\'m getting pretty weird error:

A         


        
7条回答
  •  渐次进展
    2021-01-30 20:52

    It looks like you have the right usage to apply the match, history, and location props to your component. I would check in your node_modules directory to see what versions of react-router and react-router-dom you have, as well as the @types modules.

    I have essentially the same code as you, and mine is working with the following versions:

    {
      "@types/react-router-dom": "^4.0.4",
      "react-router-dom": "^4.1.1",
    }
    

提交回复
热议问题