UNPKG

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 663 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useMatch = void 0; const RouterProviderContext_1 = require("./RouterProviderContext.cjs"); /** * Hook to match the current location against a pattern. * This is a router-agnostic wrapper that uses the configured router provider. * * @example * const match = useMatch({ path: '/posts/:id', end: true }); * if (match) { * console.log(match.params.id); * } */ const useMatch = (pattern) => { const provider = (0, RouterProviderContext_1.useRouterProvider)(); return provider.useMatch(pattern); }; exports.useMatch = useMatch; //# sourceMappingURL=useMatch.js.map