data: [],
 ... 
I load data from API call into data array. Then I try to arrange the data array into a map which can consist of a key, value pairs (value can be itself array) using below. 
    const dataMap = {};
    for (let i = 0; i < data.length; i+=1) {
      const key = data[i].product.name;
      const value = data[i];
      if (key in dataMap) {
        dataMap[key].push(value);
      } else {
        dataMap[key] = [value];
      }
    }
But when I do the following I get the following error. What I am doing wrong?
{[...dataMap].map(([key, value]) => {}
Invalid attempt to spread non-iterable instance
DataMap is correctly calculate but when i iterate using the following code
Object.entries(dataMap).map((key, value) => {
          console.log(key);
          console.log(value)
 })
it prints out the following. Value is some index which i dont understand why ? Value should be an array. My dataMap is a key, value (value is an array)


 
     
     
    