Redux 如何移动';实体';升级到顶层并重命名';结果';对象在normalizer中?
现在,当我规范化此数组时:Redux 如何移动';实体';升级到顶层并重命名';结果';对象在normalizer中?,redux,normalizr,Redux,Normalizr,现在,当我规范化此数组时: [ { "teamName":"abc", "description":"", "id":"123" }, { "teamName":"def", "description":"", "id":"456" } ] 正常化器输出: { "result":[ "123", "456" ], "entities":{ "te
[
{
"teamName":"abc",
"description":"",
"id":"123"
},
{
"teamName":"def",
"description":"",
"id":"456"
}
]
正常化器输出:
{
"result":[
"123",
"456"
],
"entities":{
"teams":{
"123":{
"teamName":"abc",
"description":"",
"id":"123"
},
"456":{
"teamName":"def",
"description":"",
"id":"456"
}
}
}
}
纯粹通过修改模式,有没有办法输出这个结果
{
"queries":[
"123",
"456"
],
"teams":{
"123":{
"teamName":"abc",
"description":"",
"id":"123"
},
"456":{
"teamName":"def",
"description":"",
"id":"456"
}
}
}
我知道事后我可以很容易地做到这一点,但是有没有一种内置的方法来调整输出的JSON数据的结构?normalizer意味着只使用两个顶级键,
results
和entities
为所有输出提供标准响应。没有选项来执行您的请求