0π
β
it is maybe because object keys are the same. It will override the existing data.
var data = {
a:"shashank",
b:"gupta",}
let c = Object.assign({},data,{a:"shashank1",
b:"gupta1"});
c
{a: "shashank1", b: "gupta1"}
βcβ has been overide.
instead of a object , create an array of object then push the data when data is coming from new server
Source:stackexchange.com