mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
13 lines
429 B
TypeScript
13 lines
429 B
TypeScript
import { useMatch, useResolvedPath } 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;
|
|
};
|