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<RouteParams>, React.Props<RouteParams> { }
type State = {
players: Array<Player>;
}
export class PlayersContainer extends React.Component<Props, State>{}
now in the component class the route props can be accessed like this:
let teamid = this.props.match.params.teamId;