我正在尝试使用forEach循环迭代 Mui 组件MenuItem,但收到Type 'void' is not assignable to type 'ReactNode'错误。这是我的代码片段-
<TableCell>
<Typography>expiry</Typography>
<Select variant="outlined" sx={{ width: '100%', height: 35, borderRadius: 2 }}>
{ groupData.forEach((option) => (
<MenuItem key={option.expiry} value={option.expiry}>
{option.expiry}
</MenuItem>
))}
</Select>
</TableCell>
Run Code Online (Sandbox Code Playgroud)
提前致谢