react-router-dom with TypeScript

前端 未结 7 579
清歌不尽
清歌不尽 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:49

    The way how I'm doing this:

    interface IOwnProps {
      style?: CSSProperties;
    }
    
    interface INavProps {
      item?: string;
    }
    
    type IProps = IOwnProps & RouteComponentProps;
    
    export default class MapScreen extends PureComponent {
      ...
    }
    

提交回复
热议问题