【发布时间】:2018-07-08 08:44:14
【问题描述】:
这种语法是否正确? results 是我的对象数组,它是嵌套的。
notifications: {
...state.notifications,
results: [
...state.notifications.results,
{ ...state.notifications.results }
]
}
【问题讨论】:
-
是的,这可能是有效的,尽管这看起来很奇怪
-
Is this syntax even correct?是的 -
请添加想要的结果(和
state.notifications)。在对象中展开数组很奇怪,你会得到一个以索引为键的对象,但如果需要,也可以。
标签: javascript reactjs ecmascript-6 redux