I use Leaflet to present some points on map. However, I want to place different marker depending on some parameters. The question is: is it possible to import in React whole directory of my custom markers (.png files)? Currently it looks like this:
import icon from 'leaflet/dist/images/marker-icon.png';
And then
render() {
const position = [54.40, 18.60];
let DefaultIcon = L.icon({
iconUrl: icon,
shadowUrl: iconShadow,
iconSize: [24, 36],
iconAnchor: [12, 36],
popupAnchor: [0, -25]
});
So for one marker there's one import at the top.
Say I want to import few icons, so do I have to import every single .png
file separately at the top of my react component? Or is there a way to just import a directory and then place only path to appropriate icon file?