UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

22 lines 709 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useMatchPath = void 0; const RouterProviderContext_1 = require("./RouterProviderContext.cjs"); /** * Returns the matchPath function from the configured router provider. * * @example * import { useMatchPath } from 'react-admin'; * * const MyComponent = () => { * const matchPath = useMatchPath(); * const match = matchPath('/posts/:id', '/posts/123'); * // match.params.id === '123' * }; */ const useMatchPath = () => { const provider = (0, RouterProviderContext_1.useRouterProvider)(); return provider.matchPath; }; exports.useMatchPath = useMatchPath; //# sourceMappingURL=useMatchPath.js.map