perf upgrade
This commit is contained in:
@@ -19,14 +19,13 @@ export const NavLink = ({
|
||||
include,
|
||||
exclude,
|
||||
}: NavLinkProps) => {
|
||||
const router = useRouterState();
|
||||
const pathname = useRouterState({ select: (s) => s.location.pathname });
|
||||
const isActive = useMemo(
|
||||
() =>
|
||||
(!exclude?.some((e) => router.location.pathname.includes(e)) &&
|
||||
(router.location.pathname === href ||
|
||||
(router.location.pathname.includes(href) && href !== "/"))) ||
|
||||
include?.includes(router.location.pathname),
|
||||
[router.location.pathname, href]
|
||||
(!exclude?.some((e) => pathname.includes(e)) &&
|
||||
(pathname === href || (pathname.includes(href) && href !== "/"))) ||
|
||||
include?.includes(pathname),
|
||||
[pathname, href]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user