I'm encountering an issue where clicking on different labels should show corresponding modal dialogs, but it always displays the same modal dialog for both labels ("All Recommendations"). Can anyone offer guidance on how to resolve this problem? Thank you in advance.
const ExportTypes: Array<{ label: string; id: string }> = [
{ label: 'All Recommendations', id: 'AllRecommendations' },
{ label: 'Entities By type', id: 'EntitiesBytype' },
];
const handleModalExport = useCallback(
() => {
if (ExportTypes.some(e => e.id === 'AllRecommendations')) {
openModalDialog({
title: t('Export all recommendations'),
renderContent: () => <RecommendationExportModel />,
});
}
else if(ExportTypes.some(e => e.id === 'EntitiesBytype')) {
openModalDialog({
title: t('Export all'),
renderContent: () => <RecommendationExportEntitiesModel />,
});
}
},
[openModalDialog, t],
);
{ExportTypes.map((objType) => (
<MenuItem key={objType.id} onClick={handleModalExport}>
{t(objType.label)}
</MenuItem>
))}