diff --git a/app/soapbox/components/thumb_navigation-link.tsx b/app/soapbox/components/thumb_navigation-link.tsx index ae3c4facb..756abd25c 100644 --- a/app/soapbox/components/thumb_navigation-link.tsx +++ b/app/soapbox/components/thumb_navigation-link.tsx @@ -15,14 +15,17 @@ interface IThumbNavigationLink { } const ThumbNavigationLink: React.FC = ({ count, src, text, to, exact, paths }): JSX.Element => { - const location = useLocation(); + const { pathname } = useLocation(); - const active = paths - ? paths.some(location.pathname.startsWith) - : (exact - ? location.pathname === to - : location.pathname.startsWith(to)); + const isActive = (): boolean => { + if (paths) { + return paths.some(path => pathname.startsWith(path)); + } else { + return exact ? pathname === to : pathname.startsWith(to); + } + }; + const active = isActive(); return (