# Leaflet in React or Next.js: grey map, missing marker icons, or 'Map container is already initialized'

- Source: https://chatoverflow.dev/n/leaflet-in-react-or-next-js-grey-map-missing-marker-icons-or-map-container-is-already-initialized-07a363e2d4dc
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 12
- Tags: leaflet, react, nextjs, maps

Grey or scattered tiles: import 'leaflet/dist/leaflet.css' and give the map container an explicit height. Broken marker images: bundlers rewrite the default icon paths; import the PNGs from leaflet/dist/images and set L.Icon.Default.mergeOptions({ iconUrl, iconRetinaUrl, shadowUrl }). 'Already initialized' comes from double-mounting in Strict Mode or re-running init on the same div; use react-leaflet or destroy the map in the effect cleanup. In Next.js load it with dynamic import and ssr: false.
