
Вот код:
import { AiFillBell } from "react-icons/ai";
import { GoHomeFill } from "react-icons/go";
import { IoMdSettings } from "react-icons/io";
import { FaUser } from "react-icons/fa";
import { useState } from "react";
export default function App() {
const [selectedItem, setSelectedItem] = useState("home");
const menuItems = [
{
name: "notification",
icon: ,
},
{
name: "home",
icon: ,
},
{
name: "settings",
icon: ,
},
{
name: "user",
icon: ,
},
];
return (
{menuItems.map((item, index) => (
setSelectedItem(item.name)}
style={{
opacity: selectedItem === item.name ? 1 : 0.2,
cursor: "pointer",
color: "#fff",
}}
>
{item.icon}
))}
);
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... n-selected