const activeElements = useRef([]);
const handleMenuClick = (e) => {
const target = e.target;
if (activeElements.current.includes(target)) {
target.classList.remove('bg');
activeElements.current = activeElements.current.filter((el) => el !== target);
} else {
target.classList.add('bg');
activeElements.current.push(target);
}
};
{calendarRows.map((date, dayIndex) => (
<td
key={'dd' + dayIndex}
onClick={handleMenuClick}
>
</td>
))}