I need to invalidate some react-leaflet maps which are generated after the page loads with this code:
maps = [];
mapData = mapData.map(function(assetf,index){
return(
assetf.map(function(asset, index){
var ind = index;
var indHash = "#" + ind;
var indExtra = ind + "ex";
maps.push(indExtra);
return(
<li key={ind}>
<div>{asset.description}</div>
<Map id={indExtra} style={mapStyles} center={asset.point.coordinates} zoom={7}>
<TileLayer
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
/>
</Map>
</li>
)
})
)
});
I tried using this code:
var i;
for(i=0; i < maps.length; i++){
maps[i].invalidateSize(true);
}
But this error is thrown:
Uncaught (in promise) TypeError: maps[i].invalidateSize is not a function
Thanks, Ed.