How to access location TypeScript type in React?

Hi there,

I’m new to TS with React and wondering how to access the Location type inside the RouteComponentProps interface? I’m trying to write a function that requires location:

getQueryString(location, parameter: string)

How can I dive inside RouteComponentProps to assign location to the RouteComponentProps.location type?


Can’t you use TypeScript’s built in Location? React router location is standard window.location.

getQueryString(location: Location, parameter: string)...

Lol, yeah I can - I thought I had to import something. My bad