Next.js Discord

Discord Forum

Ant Design Menu Items

Unanswered
Greyhound posted this in #help-forum
Open in Discord
GreyhoundOP
Im trying to use Menu Items from antd, where im making a onClick on a sub item:
const getMenuItems = () => {
  const uniqueYears = Array.from(new Set(installationArchivesData.map(archive => archive.year)));

  return (
    <Menu onClick={handleContextMenuClose} style={{ backgroundColor: 'rgba(255, 255, 255, 0.95)', border: '1px solid #d9d9d9' }}>
      <Menu.Item key="reports">General</Menu.Item>
      <Menu.SubMenu key="archives" title="Archives">
        {uniqueYears.map((year, index) => (
          <Menu.SubMenu key={year} title={year}>
            {installationArchivesData
              .filter(archive => archive.year === year)
              .map((archive, index) => (
                <Menu.Item key={`${archive.year}-${archive.month}`} onClick={() => handleClickArchiveMenuItem(id, clickedInstallationId, archive.year, archive.month)} >
                  {dayjs(`${archive.year}-${archive.month}-01`).format('MMMM')}
                </Menu.Item>
                
              ))}
          </Menu.SubMenu>
        ))}
      </Menu.SubMenu>
    </Menu>
  );
};


But for some reason, this onClick doesnt work - like aint nothing happening on the function :/

0 Replies