Redux normalizr - how can i merge all normalized object together

ぃ、小莉子 提交于 2021-01-28 06:00:12

问题


I am using redux with normlizr after normalizing the object I got the following store structure:

{
  posts: {
    byId : {

         "123":{..obj},
         "124":{..obj}
    }
  
  },
  comments: {
    byId : {

         "123":{..obj},
         "124":{..obj}
    }
  },
  users:{
    byId : {

         "123":{..obj},
         "124":{..obj}
    }
  }
}

the ids are the same as the posts (post is the parent lets say)

so when I select all posts I got smth like :

{
 posts : [
       { 
          "id" : "123",
           ...data
           "comment":"123",
           "user": "123"
       }
 ]
}

but I would like the data of comment and user also inside the posts array result instead of only id

how can I achieve that?

来源:https://stackoverflow.com/questions/64853944/redux-normalizr-how-can-i-merge-all-normalized-object-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!