Skip to main content
Version: v3.x

Map placeholder

import { MapContainer, TileLayer } from 'react-leaflet'

function MapPlaceholder() {
return (
<p>
Map of London.{' '}
<noscript>You need to enable JavaScript to see this map.</noscript>
</p>
)
}

function MapWithPlaceholder() {
return (
<MapContainer
center={[51.505, -0.09]}
zoom={13}
placeholder={<MapPlaceholder />}>
<TileLayer
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
</MapContainer>
)
}