I'm trying to learn something and develop a google map project with react-leaflet using JavaScript. I've made a simple React app and implemented the simple google map layer. Maps however are only drawn partially.
There are no errors neither in the vs code or the console.
import React from "react";
import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet";
const center = [41.015137, 28.97953]; // Set your initial map center coordinates
function App() {
return (
<MapContainer
center={center}
zoom={13}
style={{ height: "500px", width: "100%" }}
>
<TileLayer
url={`https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&hl=en&gl=US&${process.env.REACT_APP_GOOGLE_MAPS_API_KEY}`}
subdomains={["mt0", "mt1", "mt2", "mt3"]}
/>
<Marker position={center}>
<Popup>A sample marker on the map.</Popup>
</Marker>
</MapContainer>
);
}
export default App;
I also believe that the problem is not related to the API key since it worked well with @react-google-maps/api.