ThumbNavigationLink: fix runtime error
No clue why that was happening
This commit is contained in:
parent
9fb3439cda
commit
c82d191dd8
|
@ -15,14 +15,17 @@ interface IThumbNavigationLink {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThumbNavigationLink: React.FC<IThumbNavigationLink> = ({ count, src, text, to, exact, paths }): JSX.Element => {
|
const ThumbNavigationLink: React.FC<IThumbNavigationLink> = ({ count, src, text, to, exact, paths }): JSX.Element => {
|
||||||
const location = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
const active = paths
|
const isActive = (): boolean => {
|
||||||
? paths.some(location.pathname.startsWith)
|
if (paths) {
|
||||||
: (exact
|
return paths.some(path => pathname.startsWith(path));
|
||||||
? location.pathname === to
|
} else {
|
||||||
: location.pathname.startsWith(to));
|
return exact ? pathname === to : pathname.startsWith(to);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const active = isActive();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavLink to={to} exact={exact} className='thumb-navigation__link'>
|
<NavLink to={to} exact={exact} className='thumb-navigation__link'>
|
||||||
|
|
Loading…
Reference in New Issue