Last active
February 20, 2023 19:14
-
-
Save JenniferFuBook/df2e20a506befb8ff92e59b55434b3b0 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 { useEffect } from 'react'; | |
import L from 'leaflet'; | |
import 'leaflet/dist/leaflet.css'; | |
function App() { | |
const mapId = 'map'; | |
useEffect(() => { | |
const map = L.map(mapId, { | |
center: [37.774929, -122.419418], | |
zoom: 8, | |
}); | |
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}{r}.png', { | |
attribution: | |
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', | |
}).addTo(map); | |
}, []); | |
return ( | |
<div id={mapId}></div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment