根据当前位置解析给定的 to
值的路径名。类似于 useHref,但返回一个 Path 对象而不是字符串。
import { useResolvedPath } from "react-router";
function SomeComponent() {
// if the user is at /dashboard/profile
let path = useResolvedPath("../accounts");
path.pathname; // "/dashboard/accounts"
path.search; // ""
path.hash; // ""
}
useResolvedPath(to, __namedParameters): Path
暂无文档
暂无文档