0.1.7 • Published 5 years ago

mapbox-hooks v0.1.7

Weekly downloads
7
License
MIT
Repository
-
Last release
5 years ago

useMapbox

A simple hook that provides an easy way to get up and running with mapbox-gl-js in your React app.

Install

$ npm install mapbox-hooks mapbox-gl-js @mapbox/mapbox-gl-geocoder

Usage

import { useMapbox } from 'mapbox-hooks';

const accessToken = 'YOUR_ACCESS_TOKEN';
const options = {};

function App() {
  const { setContainer, map, loaded } = useMapbox({ accessToken, options });

  return <div ref={setContainer} />
}

Once the the map has loaded you will have access to the Map instance to use however you want: https://docs.mapbox.com/mapbox-gl-js/api/

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago