Files
EMS-ESP32/interface/src/components/routing/useRouterTab.ts
2023-12-10 14:50:34 +01:00

13 lines
418 B
TypeScript

import { useLocation } from 'react-router-dom';
export const useRouterTab = () => {
const loc = useLocation().pathname;
const routerTab = loc.substring(0, loc.lastIndexOf('/')) ? loc : false;
// const routerTabPath = useResolvedPath(':tab');
// const routerTabPathMatch = useMatch(routerTabPath.pathname);
// const routerTab = routerTabPathMatch?.params?.tab || false;
return { routerTab } as const;
};