I'm having a JSON data like this
const dataArr = [{
id: "8",
data: { label: "node 4" },
position: { x: 0, y: 0 },
selectable: true,
},
{
id: "e12",
source: "1",
target: "2b",
type: "smoothstep",
animated: false,
style: { stroke: "", width: "" },
},
....
]
How can I update value
of stroke
- style: { stroke: "", width: "" },
?
I tried
let tempArr = [...dataArr];
tempArr.filter((x) => x.target == "someValue").forEach((x)=> {x.style.stroke = "#SomeData"})
But got error : Uncaught TypeError: "stroke" is read-only