https://dev.kronoz.win/r/marzneshin.git
1import { useRouterState } from "@tanstack/react-router";
2
3export const useIsCurrentRoute = () => {
4 const router = useRouterState();
5 const currentActivePath = router.location.pathname;
6
7 const isCurrentRouteActive = (path: string) => {
8 if (path === "/") {
9 return currentActivePath === path;
10 }
11 return currentActivePath.startsWith(path);
12 };
13
14 return { isCurrentRouteActive };
15}