
How am i to fix the this any type error?
I tried passing custom type but that didn't work
You can import Location from history. So update would be like this
import { Location } from "history";
const location = useLocation<Location>();
or alternatively you can create types
type LocationTypes = {
pathname: string;
state: any; //Here you can put your data type instead of any
search: string;
hash: string;
key: string;
}
const location = useLocation<LocationTypes>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With