I have a component that looks like this:
class MyView extends React.Component<{}, {}> {
render() {
console.log((this.props as any).params); // prints empty object
return (
<div>Sample</div>
);
}
}
I want to print the URL query params but I get an empty object. (Yes, I know that I declared {} as Props but if I don't define it, it does not compile).
Is there a way to pass a "default" props object to my component so that I can access this.props.params? Or should it be done in a different way in TypeScript?
paramproperty to it?