Files
SnowLuma/.pnpm-store/v11/files/68/8f0618633fc0aaea14ed3519fc77bec2849d32656e8cbd5464f983023500736c762c8706ec3b1cef3148bd2852af0e4e28c4400f8daeea51c6133f0e8fe4c4
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

30 lines
1.0 KiB
Plaintext

import { useMatch } from "./useMatch.js";
//#region src/useParams.tsx
/**
* Access the current route's path parameters with type-safety.
*
* Options:
* - `from`/`strict`: Specify the matched route and whether to enforce strict typing
* - `select`: Project the params object to a derived value for memoized renders
* - `structuralSharing`: Enable structural sharing for stable references
* - `shouldThrow`: Throw if the route is not found in strict contexts
*
* @returns The params object (or selected value) for the matched route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useParamsHook
*/
function useParams(opts) {
return useMatch({
from: opts.from,
shouldThrow: opts.shouldThrow,
structuralSharing: opts.structuralSharing,
strict: opts.strict,
select: (match) => {
const params = opts.strict === false ? match.params : match._strictParams;
return opts.select ? opts.select(params) : params;
}
});
}
//#endregion
export { useParams };
//# sourceMappingURL=useParams.js.map