Am using react-admin.
I replaced/changed the <DashboardMenuItem> to <MenuItemLink> (overview).
Unfortunately, this "overview" appears active selected all the time.
Any idea how to deactivate it when another menu item is selected?

In the attached image, notice that "Overview" and "Reviews" appear to be selected (
active)
// Removed this line...
- <DashboardMenuItem onClick={onMenuClick} sidebarIsOpen={open} />
// And replaced it with this...
+ <MenuItemLink
to={`/`} // by default `react-admin` renders Dashboard on this route
primaryText={translate(`resources.overview.name`, {
smart_count: 2
})}
leftIcon={<DashboardIcon />}
onClick={onMenuClick}
sidebarIsOpen={open}
dense={dense}
/>
According to react-router documentation, you can do that by add props exact to the link component:
<MenuItemLink
to={`/`} // by default `react-admin` renders Dashboard on this route
primaryText={translate(`resources.overview.name`, {
smart_count: 2
})}
leftIcon={<DashboardIcon />}
onClick={onMenuClick}
sidebarIsOpen={open}
dense={dense}
exact
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With