# mapbox-hooks

> A simple hook that provides an easy way to get up and running with [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js) in your React app.

Latest version **0.1.7** (published 2020-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install mapbox-hooks
pnpm add mapbox-hooks
yarn add mapbox-hooks
bun add mapbox-hooks
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2020-02-22 |
| First published | 2020-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Leigh Kendell |
| Maintainers | leighkendell |

## Links

- npm: https://www.npmjs.com/package/mapbox-hooks
- npm.io page: https://npm.io/package/mapbox-hooks

## Recent versions

- 0.1.7 (latest) — 2020-02-22
- 0.1.6 — 2020-02-22
- 0.1.5 — 2020-02-22
- 0.1.4 — 2020-02-22
- 0.1.3 — 2020-02-22
- 0.1.2 — 2020-02-22
- 0.1.1 — 2020-02-22

## README

# useMapbox

A simple hook that provides an easy way to get up and running with [mapbox-gl-js](https://github.com/mapbox/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/

---
_Source: https://npm.io/package/mapbox-hooks · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
