bugfix: menuGroup build unique key

This commit is contained in:
tangly1024
2022-01-04 13:43:32 +08:00
parent 79133cce84
commit f283547da4

View File

@@ -20,7 +20,7 @@ const MenuButtonGroup = ({ allowCollapse = false }) => {
{links.map(link => {
if (link.show) {
const selected = (router.pathname === link.to) || (router.asPath === link.to)
return <Link key={link.id + link.icon} title={link.to} href={link.to} >
return <Link key={`${link.id}-${link.to}`} title={link.to} href={link.to} >
<a className={'py-1 my-1 px-5 mx-2 duration-300 text-base hover:bg-gray-500 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center ' +
(selected ? 'bg-gray-700 text-white ' : ' ')} >
<div className='my-auto justify-center flex '>
@@ -30,7 +30,7 @@ const MenuButtonGroup = ({ allowCollapse = false }) => {
</a>
</Link>
} else {
return <></>
return null
}
})}
</nav>