【发布时间】:2017-11-22 17:50:58
【问题描述】:
大家好,我正在尝试为我的personas ={[]} 中的每个缩略图创建一个 div,它应该使用 this.props.personas.map 之类的东西
{this.props.personas.map(thumbnail => {
return <div><img src={this.props.thumbnail /}></div>
})}
我已经尝试过了,但失败了,这是我的垃圾箱。 Bin
有什么建议吗?我做错了什么
【问题讨论】:
-
检查您的控制台。数组或迭代器中的每个子元素都应该有一个唯一的“key”属性。
-
键应该是唯一的,我已将索引添加为您的 bin 中的键
标签: arrays reactjs foreach ecmascript-6 thumbnails