SidebarNavigationLink: fix isActive
This commit is contained in:
parent
47e5f4c9d1
commit
0a66f2585b
|
@ -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<HTMLAnchorElement>): 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<React.MouseEvent> = (e) => {
|
||||
if (onClick) {
|
||||
|
|
Loading…
Reference in New Issue