Created
September 1, 2022 06:41
-
-
Save MrMeison/d27352ce02afc971014c550974edcf20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Map = (props: PropsMap) => { | |
... | |
useEffect(() => { | |
if (!map) { | |
return; | |
} | |
const layerGroup = new LayerGroup(); | |
points.forEach((point) => { | |
leaflet | |
.marker(...).addTo(layerGroup); | |
}); | |
map.addLayer(layerGroup); | |
return () => { | |
layerGroup.remove(); | |
}; | |
}, [map, points]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment