Last active
March 4, 2023 05:53
-
-
Save JenniferFuBook/615364e6ef12bbf8e3691b4c131beb10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MapContainer, TileLayer, Marker } from 'react-leaflet'; | |
import { Icon } from 'leaflet'; | |
import 'leaflet/dist/leaflet.css'; | |
import markerIconPng from 'leaflet/dist/images/marker-icon.png'; | |
import markShadowPng from 'leaflet/dist/images/marker-shadow.png'; | |
function App() { | |
return ( | |
<MapContainer center={[38.907192, -77.036873]} zoom={8}> | |
<TileLayer | |
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | |
url="https://tile.openstreetmap.org/{z}/{x}/{y}{r}.png" | |
/> | |
<Marker | |
position={[38.907192, -77.036873]} | |
icon={ | |
new Icon({ | |
iconUrl: markerIconPng, | |
shadowUrl: markShadowPng, | |
}) | |
} | |
title="Capital City" | |
draggable | |
/> | |
</MapContainer> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment