score:0

i'm guessing your are not creating a new array instance when updating the clickedmarkers array. if you mutate the array directly, react will not know the property has changed.

try using the spread operator to create a new array instance when updating the clickedmarkers state in the onclick function.

onclick = (e, markerindex) => {
    clickedmarkers[markerindex] = true; // change value logic
    this.setstate({clickedmarkers: [...clickedmarkers]}); // spread operator to create new array instance
}

Related Query

More Query from same tag