在React / Redux中,我有一个动态对象(action.payload):
{
cars: "Ferrari"
}
我需要将它组合到一个嵌套对象(redux):
{
filters: {
ships: ['Star'],
cars: ['Ford']
airplanes: ['Boeing']
}
}
我尝试了这个,但似乎这与过滤器'合并了仍在维护:
return {
...state,
filters: Object.assign({}, state.filters, action.payload)
}
我期待数组合并并得到类似的东西:
{
filters: {
ships: ['Star'],
cars: ['Ford', 'Ferrari']
airplanes: ['Boeing']
}
}
答案 0 :(得分:0)
你可以试试这个:
Posts:
-Kier498dma39md:
content: 'This is an example post. The numbers above me are an example of the random key I am trying to get.'