【发布时间】:2019-04-10 18:41:03
【问题描述】:
我想在 REACTJS 中将以下 Map 转换为 Object 我怎样才能做到这一点
[
{
"lastName": "Last name should have atleast 1 characters "
},
{
"role": "may not be null"
},
{
"name": "Name should have atleast 1 characters "
}
]
转换成
{
"lastName": "Last name should have atleast 1 characters ",
"role": "may not be null",
"name": "Name should have atleast 1 characters "
}
【问题讨论】:
-
这是非常不规则的结构。理想情况下,您应该首先修复它。
-
在第一个 Code sn-p 中,我使用了 Map,但我想要第二个 Snippet 之类的结构,你能帮我举个 codepen 中的例子吗
标签: arrays reactjs dictionary