The only problem I am facing is, either one of them dont work when put together. Both work fine independently. When put together, I can see the routes changing but the active Item doesn't switch.
{SidebarData.map((item, index)=>{
return(
<div className={selected===index?'menuItem active': 'menuItem'}
key={index}
onClick={()=>{setSelected(index); window.location.pathname= item.link; }}
>
<item.icon/>
<span>
{item.heading}
</span>
</div>
)
})}
export const SidebarData = [
{
icon: UilEstate,
heading: "Dashboard",
link: "/Dashboard",
},
{
icon: UilLaptop ,
heading: "Exams",
link: "/Exams",
},
{
icon: UilFileCheck ,
heading: "Results",
link: "/Result",
},