我有这样一组数据使用地图至jsx打印对象的属性?
const data = [{
date: '2017-1-1',
abc: 1,
def: 2
},{
date: '2017-1-2',
abc: 3,
def: 6
}]
的如何打印
on date of 2017-1-1
abc is equal to 1 and def is equal to 2
on date of 2017-1-2
abc is equal to 3 and def is equal to 6
我卡在得到ABC和DEF财产出去JSX。如果我做data.map(o => o.abc),我可以得到1,但是如何使用map获取属性?或者我应该使用Object.keys
和forEach?
我不能硬编码abc或def coz它可能有其他新属性。
笑ABC和DEF硬编码 –