I am using react-leaflet for creating some polygons in map()
function.
I need latter to access one of them and change some of the attributes, in example change fillCollor
or fillOpacity
render() {
return (
<div className={'ZoneLayer'}>
{
this.zones.map(zone => {
return (
<Polygon key={zone['id']}
id={zone['id']}
positions={zone['coordinates']}
color={zone['available'] ? "#6dfdae" : "#dddddd"}
fillOpacity={this.props.enableTransparency ? 0.4 : 1} >
<Tooltip direction={"top"} sticky={true} className={"zone-tooltip"} >
<span>{zone['text']}</span>
</Tooltip>
</Polygon>
);
})
}
</div>
)
}
How can I access one of the created components from another component?