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
After browsing the typescript definitions I discovered the RouteComponentProps
interface so I now model my containers like so
type RouteParams = {
teamId: string; // must be type string since route params
}
interface Props extends RouteComponentProps, React.Props { }
type State = {
players: Array;
}
export class PlayersContainer extends React.Component{}
now in the component class the route props can be accessed like this:
let teamid = this.props.match.params.teamId;