Files
cinny/src/app/hooks/router/useDirectSelected.ts
T

23 lines
493 B
TypeScript
Raw Normal View History

import { useMatch } from 'react-router-dom';
import { getDirectCreatePath, getDirectPath } from '../../pages/pathUtils';
export const useDirectSelected = (): boolean => {
const directMatch = useMatch({
path: getDirectPath(),
caseSensitive: true,
end: false,
});
return !!directMatch;
};
export const useDirectCreateSelected = (): boolean => {
const match = useMatch({
path: getDirectCreatePath(),
caseSensitive: true,
end: false,
});
return !!match;
};