React Leaflet for Gatsby
npm install gatsby-plugin-react-leafletThis package takes care of setting up your project for React Leaflet.
The current npm version is for Gatsby v5.
First install the packages.
```
npm i --save gatsby-plugin-react-leaflet react-leaflet leaflet
Add the plugin to your Gatsby configuration.
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.
``javascriptconst IndexPage = () => {
return (
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
A pretty CSS3 popup.
Easily customizable.
)
}