Skip to content

Instantly share code, notes, and snippets.

@leighhalliday
Last active February 4, 2021 12:22
Show Gist options
  • Save leighhalliday/c67d811d7b83ab1628d8ddfb34abd939 to your computer and use it in GitHub Desktop.
Save leighhalliday/c67d811d7b83ab1628d8ddfb34abd939 to your computer and use it in GitHub Desktop.
Minimal Mapbox
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