useLocation返回当前位置对象。
import { useLocation } from "@remix-run/react";
function SomeComponent() {
const location = useLocation();
// ...
}
location.hash当前 URL 的哈希值。
location.key此位置的唯一键。
location.pathname当前 URL 的路径。
location.search当前 URL 的查询字符串。
location.state由 <Link state> 或 navigate 创建的位置的状态值。