diff --git a/src/components/sidebar-navigation-link.tsx b/src/components/sidebar-navigation-link.tsx index 336aac5ae..e5aca128e 100644 --- a/src/components/sidebar-navigation-link.tsx +++ b/src/components/sidebar-navigation-link.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import React from 'react'; -import { NavLink } from 'react-router-dom'; +import { NavLink, useLocation } from 'react-router-dom'; import { Icon, Text } from './ui'; @@ -24,7 +24,9 @@ interface ISidebarNavigationLink { /** Desktop sidebar navigation link. */ const SidebarNavigationLink = React.forwardRef((props: ISidebarNavigationLink, ref: React.ForwardedRef): JSX.Element => { const { icon, activeIcon, text, to = '', count, countMax, onClick } = props; - const isActive = location.pathname === to; + const { pathname } = useLocation(); + + const isActive = pathname === to; const handleClick: React.EventHandler = (e) => { if (onClick) {