can you help me with this problem with js\react? I'm trying to manage 2 arrays due to obtain a new object based on their shared attribute (Array A: "id" and Array B: "parent")
I think isn't hard but I'm struggling to do it atm :(
Array A
[{
  "id": "606f1a2bebb5fb53804dd3d5",
  "name": "cc",
}, {
  "id": "606f1a30cfe84430c41dce88",
  "name": "bb",
}, {
  "id": "606f1a4ed2ff554e4ea11b82",
  "name": "ff",
}]
Array B
[{
  "id": "3344",
  "color": "pink",
  "parent": "606f1a2bebb5fb53804dd3d5",
}, {
  "id": "3453",
  "color": "blue",
  "parent": "606f1a30cfe84430c41dce88",
}, {
  "id": "3331",
  "color": "yellow",
  "parent": "606f1a4ed2ff554e4ea11b82",
}, {
  "id": "4442",
  "color": "black",
  "parent": "606f1a30cfe84430c41dce88",
}]
I want merge these two arrays and create a new one where the array B objects are split by "id" of array A.
Something like this:
[{
  "606f1a2bebb5fb53804dd3d5": [{
    "id": "3344",
    "color": "pink",
    "parent": "606f1a2bebb5fb53804dd3d5",
  }]
}, {
  "606f1a30cfe84430c41dce88": [{
    "id": "3453",
    "color": "blue",
    "parent": "606f1a30cfe84430c41dce88",
  }, {
    "id": "4442",
    "color": "black",
    "parent": "606f1a30cfe84430c41dce88",
  }]
}, {
  "606f1a4ed2ff554e4ea11b82": [{
    "id": "3331",
    "color": "yellow",
    "parent": "606f1a4ed2ff554e4ea11b82",
  }]
}]
Thanks very much guys
 
     
     
     
     
    