import { Location } from "history";
const location = useLocation<Location>();
也可以创建类型
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>();
1条答案
按热度按时间wztqucjr1#
您可以从历史记录中导入位置。因此更新将如下所示
也可以创建类型