I have an array containing 7 objects named is NewClass.
When I make some changes to the objects, the object has lost its original NewClass name.
Like that:
In arrray[6] lost NewClass name.
So is there any way I can keep the NewClass name for that object?
Here is my function to handle this array:
useEffect(() => {
console.log(layers);
if (selectedLayerIndex && layers.length > 0) {
console.log(
'x',
layers.map((x) => {
if (x.feature.properties.editLayerId === selectedLayerIndex) {
console.log(x);
return (x = {
...x,
options: { ...x.options, color: 'cyan', fillColor: 'cyan' },
});
}
return x;
})
);
}
}, [selectedLayerIndex]);
Thank you so much!

