UNPKG

ra-core

Version:

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

18 lines 534 B
import { useRouterProvider } from "./RouterProviderContext.js"; /** * 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' * }; */ export const useMatchPath = () => { const provider = useRouterProvider(); return provider.matchPath; }; //# sourceMappingURL=useMatchPath.js.map