I \'ve put together a very simple React / Leaflet demo but the marker icon is not showing at all. Full running code is here.
Here\'s what I have in my componentDid
Here's what worked for me in the end (I'm on webpack):
const defaultIcon = new L.icon({
iconUrl: require('../node_modules/leaflet/dist/images/marker-icon.png'); // your path may vary ...
iconSize: [8, 8],
iconAnchor: [2, 2],
popupAnchor: [0, -2]
});
generateMarkers().forEach( c=> {
L.marker(c, {icon: defaultIcon}).addTo(this.map).bindPopup('a marker; yeah').openPopup();
}