Last active
February 4, 2021 12:22
-
-
Save leighhalliday/c67d811d7b83ab1628d8ddfb34abd939 to your computer and use it in GitHub Desktop.
Minimal Mapbox
This file contains 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 { useState } from "react"; | |
import ReactMapGL from "react-map-gl"; | |
import "mapbox-gl/dist/mapbox-gl.css"; | |
export default function Home() { | |
const [viewport, setViewport] = useState({ | |
latitude: 43, | |
longitude: -79, | |
zoom: 8, | |
}); | |
return ( | |
<div> | |
<ReactMapGL | |
{...viewport} | |
width="100%" | |
height="100vh" | |
onViewportChange={(nextViewport) => setViewport(nextViewport)} | |
mapboxApiAccessToken={"YOUR_KEY"} | |
></ReactMapGL> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment