Files
SnowLuma/.pnpm-store/v11/files/1e/21186efc2ff362d10ce71bcbb1b1df92ab3774af23f01564671bb14951fb185284b353683f739be324d80c416772663e7bc9aae7f987dbabf0e6fc41601bdc
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

25 lines
803 B
Plaintext

"use client";
import { routerContext } from "./routerContext.js";
import * as React$1 from "react";
//#region src/useRouter.tsx
/**
* Access the current TanStack Router instance from React context.
* Must be used within a `RouterProvider`.
*
* Options:
* - `warn`: Log a warning if no router context is found (default: true).
*
* @returns The registered router instance.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook
*/
function useRouter(opts) {
const value = React$1.useContext(routerContext);
if (process.env.NODE_ENV !== "production") {
if ((opts?.warn ?? true) && !value) console.warn("Warning: useRouter must be used inside a <RouterProvider> component!");
}
return value;
}
//#endregion
export { useRouter };
//# sourceMappingURL=useRouter.js.map