ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
20 lines • 692 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useInRouterContext = void 0;
const RouterProviderContext_1 = require("./RouterProviderContext.cjs");
/**
* Hook to check if we are inside a router context.
* This is a router-agnostic wrapper that uses the configured router provider.
*
* @example
* const isInRouter = useInRouterContext();
* if (!isInRouter) {
* // Need to wrap with a router
* }
*/
const useInRouterContext = () => {
const provider = (0, RouterProviderContext_1.useRouterProvider)();
return provider.useInRouterContext();
};
exports.useInRouterContext = useInRouterContext;
//# sourceMappingURL=useInRouterContext.js.map