const router = useRouter();
const [matchedRouteIds, setMatchedRouteIds] = useState(
router.state.matches.map((m) => m.id)
);
useEffect(() => {
return router.subscribe("onResolved", () => {
const newMatchedRouteIds = router.state.matches.map((m) => m.id);
setMatchedRouteIds(newMatchedRouteIds);
});
}, [router]);
const isUsersRouteActive = matchedRouteIds.includes(usersRoute.id);
const router = useRouter();
const [matchedRouteIds, setMatchedRouteIds] = useState(
router.state.matches.map((m) => m.id)
);
useEffect(() => {
return router.subscribe("onResolved", () => {
const newMatchedRouteIds = router.state.matches.map((m) => m.id);
setMatchedRouteIds(newMatchedRouteIds);
});
}, [router]);
const isUsersRouteActive = matchedRouteIds.includes(usersRoute.id);