# gatsby-plugin-react-leaflet

> React Leaflet for Gatsby

Latest version **4.0.3** (published 2022-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install gatsby-plugin-react-leaflet
pnpm add gatsby-plugin-react-leaflet
yarn add gatsby-plugin-react-leaflet
bun add gatsby-plugin-react-leaflet
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2022-11-27 |
| First published | 2018-07-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28 |
| Author | David Weirich |
| Maintainers | dweirich |
| Keywords | gatsby, gatsby-plugin, react-leaflet |

## Links

- npm: https://www.npmjs.com/package/gatsby-plugin-react-leaflet
- Repository: https://github.com/dweirich/gatsby-plugin-react-leaflet
- Homepage: https://github.com/dweirich/gatsby-plugin-react-leaflet#readme
- Issues: https://github.com/dweirich/gatsby-plugin-react-leaflet/issues
- npm.io page: https://npm.io/package/gatsby-plugin-react-leaflet

## Recent versions

- 4.0.3 (latest) — 2022-11-27
- 2.0.11-beta.0 (beta) — 2019-06-10
- 2.0.0-alpha.3 (next) — 2018-07-21
- 4.0.2 — 2022-11-27
- 4.0.1 — 2022-11-27
- 4.0.0 — 2022-11-27
- 3.0.3 — 2021-12-06
- 3.0.2 — 2021-05-18
- 3.0.1 — 2021-05-18
- 3.0.0 — 2021-01-24
- 2.0.13 — 2020-04-23
- 2.0.12 — 2020-02-08
- 2.0.11 — 2019-06-17
- 2.0.10 — 2019-06-08
- 2.0.9 — 2019-06-08
- … 19 more at https://npm.io/package/gatsby-plugin-react-leaflet/versions

## README

# Getting started

This package takes care of setting up your project for [React Leaflet](https://react-leaflet.js.org/).

The current npm version is for Gatsby v5.


## Step 1

First install the packages.
```
npm i --save gatsby-plugin-react-leaflet react-leaflet leaflet
```

## Step 2

Add the plugin to your Gatsby configuration.

### gatsby-config.js
```javascript
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-react-leaflet',
      options: {
        linkStyles: true // (default: true) Enable/disable loading stylesheets via CDN
      }
    }
  ]
}
```

## Step 3

Add your React Leaflet components.

```javascript
import React from 'react'
import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'

const IndexPage = () => {
  return (
    <MapContainer style={{ height: '400px' }} center={[51.505, -0.09]} zoom={13} scrollWheelZoom={false}>
      <TileLayer
        attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
        url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
      />
      <Marker position={[51.505, -0.09]}>
        <Popup>
          A pretty CSS3 popup. <br /> Easily customizable.
        </Popup>
      </Marker>
    </MapContainer>
  )
}

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