import { useMemo, forwardRef } from 'react'; import { useMatch } from 'react-router-dom'; import ListItem from '@mui/material/ListItemButton'; import ListItemIcon from '@mui/material/ListItemIcon'; import ListItemText from '@mui/material/ListItemText'; import { Link, LinkProps } from 'react-router-dom'; type ListItemLinkProps = { icon: React.ReactNode; primary: string; to: string; } export default function ListItemLink(props: ListItemLinkProps) { const { icon, primary, to } = props; const selected = useMatch({ path: to, end: false }); const CustomLink = useMemo( () => forwardRef>(function InLineLink( linkProps, ref, ) { return ; }), [to], ); return (
  • {icon}
  • ); };