【发布时间】:2018-10-08 03:47:34
【问题描述】:
注意:它的 App.js 组件
我有一个国家
state = {
contacts: [...data is coming from an api],
bgColors: ["bg-red","bg-blue",...so On]
// bg colors array consist of class coming from css
}
内部渲染函数->
我使用this.state.contacts.map 显示来自联系人(状态)的数据
在map函数里面有一个div,className
<div className={`col-sm-3 relative book ${Here I want to display bgColors String one by one} `}>
【问题讨论】:
标签: javascript reactjs state setstate