【发布时间】:2021-01-15 00:27:31
【问题描述】:
我找到了一些对象的名称并具有以下源代码:
const findAndRenderName = (projectId: number| undefined) => {
//i want to render here something when the condtion will pass
projectList?.map(project => projectId = project.id)
}
return (
<DetailsBox title={t('catalogPage.componentDetails.specs.used')}>
{
component?.projects.map(project => findAndRenderName(project.id))
}
</DetailsBox>
);
如何从map 函数中生成if,知道吗?
【问题讨论】:
标签: arrays typescript dictionary filter