I'm bit confused. Could you help me ? It's easy but I'm not able to solve my problem.
I have tree like that.
[{
label: "Label 1",
colspan: 0,
columns: [
{
data: "Colunm1"
},
{
data: "Column2"
}
]
},
{
label: "Label 2",
colspan: 0,
columns: [
{
data: "Column3",
editor: false
},
{
data: "Column4"
},
{
data: "Column5"
}
]
},
{
label: "Label 3",
colspan: 0,
columns: [
{
data: "Column6"
},
{
data: "Column7"
},
{
data: "Column8"
}
]
}]
As you can see there is an editor
key inside second object columns array. I want to add editor
key to same level inside all object with spread operator.
I started to write the code but I'm stuck.
this.columns = [...this.columns, ...item.columns];
Also I have this.columns
definition in constructor
hook. So, I want to create new copy into this definition. Above data structure is imported from another file and I'm iterating that for create a new copy of columns array.