Setup
- Follow all the steps from the installation page
- Add the following code to your app and check it displays correctly:
<MapContainer center={[51.505, -0.09]} zoom={13}>
<TileLayer
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<Marker position={[51.505, -0.09]}>
<Popup>
A pretty CSS3 popup. <br /> Easily customizable.
</Popup>
</Marker>
</MapContainer>
If the map is not displayed properly, it is most likely because you haven't followed all the prerequisites.
- Make sure all dependencies are installed and using supported versions
- Make sure Leaflet's CSS is loaded
- Make sure your map container has a defined height
If you're still having trouble, you can use the react-leaflet
tag on Stack Overflow.