0
我有以下JSON对象,并且在构建Message.jsx时,我希望在节数组中包含当前消息元素的编号。我怎么能这样做?获取父数组对象中当前元素的编号
{ "sections": [
{
"message": {
"from": "someone",
"body": "ibsum"
}
},
{
"message": {
"from": "someone else",
"body": "lorem"
}
}, ... ] }
我可以真正做到这一点,而不需要明确地设置节数组中的每个对象的ID属性吗?