【发布时间】:2019-02-19 12:03:35
【问题描述】:
我正在尝试使用 .map 进行简单的循环,但没有得到预期的输出。这是我的代码-
const filters = [this.state.filterAttributes ] //[Part Number, Product Line]
<tr key = {key}>
{filters.map((k) => {
return <th>{k}</th>
})}
<td>{item.PartNumber}</td>
<td>{item.productline}</td>
</tr>
th{k} 返回为 <th>Part NumberProduct Line</th> 而不是
<th>Part Number</th>
<th>Product Line</th>
有人可以帮忙吗?
【问题讨论】:
标签: javascript arrays reactjs jsx