UNPKG

ra-core

Version:

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

16 lines (14 loc) 461 B
import { useRouterProvider } from './RouterProviderContext'; import type { RouterLocation } from './RouterProvider'; /** * Hook to access the current location. * This is a router-agnostic wrapper that uses the configured router provider. * * @example * const location = useLocation(); * console.log(location.pathname); */ export const useLocation = (): RouterLocation => { const provider = useRouterProvider(); return provider.useLocation(); };