这里,当我点击比特币。父组件发送比特币作为标题。我不想在选择标签中包括比特币。
发布于 2022-01-25 15:21:32
您将直接从map函数返回该选项,如果要在其中添加逻辑,只需在其中添加{}
和return
语句即可。
{coins.map((item) => {
// you can put your logic here
// for example just first 2 letters
const customTitle = item.title.slice(0, 2)
return (
<option>{customTitle}</option>
)
})}
您可以阅读更多关于arrow functions
这里的内容。
https://stackoverflow.com/questions/70851052
复制相似问题