I was trying to show a sample map on my react website. I have installed the leaflet package and also the react-leaflet package then set everything up as the react-leaflet document said to do. You can see my code below for a reference on how I set it up.
<div>
<h3 className='text-4xl my-4 text-center text-slate-800 font-bold'>Maps and Direction</h3>
<div className='mx-auto py-2' style={{ width: "80%", height: "100%" }}>
<MapContainer center={position} zoom={13} scrollWheelZoom={true}>
<TileLayer attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
<Marker position={position}>
<Popup>
Website Name
</Popup>
</Marker>
</MapContainer>
</div>
</div>
I have also imported the leaflet css CDN in my index.html like this,
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin="" />
I have also set a defined height and width of the map container as you can see in my code. But it shows some scattered parts of the map like this picture.
.
Please can anyone help me with what could be the problem or if I'm missing any instruction.