# React Leaflet — card for AI agents

React components for Leaflet maps enabling interactive mapping in React applications.

Category: 3D and graphics · npm package `react-leaflet` · latest version 5.0.0 (checked 2026-11-01)
Install: `npm install react-leaflet`
License: Hippocratic-2.1 (custom)

In your own product (generator, app, hosted service): **unclear**. A license of its own: read it before building a product on it.

## Warnings
- The license is custom (Hippocratic-2.1): read it before shipping closed-source software or a hosted service.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## React Leaflet
- The docs say React Leaflet "is not compatible with server-side rendering" because Leaflet makes direct calls to the DOM when it is loaded. Account for this in SSR frameworks.
- Use other React Leaflet components and hooks only as descendants of a `MapContainer`.
- Treat component props as immutable by default. Only props explicitly documented as mutable are updated in the UI when they change.
- Mutable prop changes are compared by reference unless the docs state otherwise. They are applied by calling the relevant method on the Leaflet instance.
- For components that should be completely replaced, set a unique value on their `key` prop. To reset a whole map, set a unique `key` on `MapContainer`.
- Do not use React's `Activity` component with the map. The docs call it incompatible with how React Leaflet works.
- Use refs to Leaflet instances carefully, since imperative calls may create inconsistencies with props. For v5, React v19 is a required peer dependency and `LeafletProvider` is no longer in the core package.

## What it is
- React Leaflet describes itself as "React components for Leaflet maps". The repository was created on 2014-08-03 and is released under the Hippocratic License 2.1. The latest release is v5.0.0, published 2024-12-14, and it makes React v19 a required peer dependency. The README points to the docs site for help. It asks that support questions go to StackOverflow under the `react-leaflet` tag, not to GitHub issues.
- The docs call it bindings between React and Leaflet. A `MapContainer` renders a container `<div>`, instantiates a Leaflet `Map` for it, and creates a React context holding that map. Each child component, such as `TileLayer`, `Marker` or `Popup`, instantiates the matching Leaflet instance and adds it to the map. When the component is removed from the render tree, it removes its layer.
- Because it leans on Leaflet, the docs warn that it "can behave differently from how other React components work". The core concepts page covers four areas where this happens: DOM rendering, props, refs and context.

## Caveats
- Not compatible with server-side rendering: The docs say Leaflet makes direct calls to the DOM when it is loaded, and that React Leaflet is therefore not compatible with server-side rendering.
- Props are immutable by default: Props are used to create the Leaflet instance on the first render. The docs say they will not be updated in the UI when they change unless they are explicitly documented as mutable.
- Some components must be replaced via key: The docs say some properties can be updated through Leaflet's setters. Other components should be completely replaced by setting a unique value on their `key` property.
- Mutable props compare by reference: The docs say changes to mutable props are compared by reference unless stated otherwise. They are applied by calling the relevant method on the Leaflet element instance.
- Incompatible with React's Activity: According to the docs, React's `Activity` component executes effects while retaining the map container element. The docs say this makes it incompatible with how React Leaflet works.

## Numbers (AgentGid data)
- Gid Score: 69.3 (#418 of all tools, 4 of 63 in its category)
- Used in 61 public projects set up for AI coding agents (1.0%)
- Downloads last week: 7,747,130 (as of 2026-11-24), +69.2% over 4 weeks
- GitHub stars: 5,608 (as of 2026-11-24)
- Last push: 2026-11-15

## Often used with
Leaflet 95.1%, Lucide React 88.5%, clsx 80.3%, Tailwind Merge 80.3%, Class Variance Authority 77.0%, React 96.7%

## Checked alternatives (same job)
- Mapbox GL: https://agentgid.com/tools/mapbox-gl/agent.md
- react-map-gl: https://agentgid.com/tools/react-map-gl/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/react-leaflet/
- Homepage: https://react-leaflet.js.org
- Repository: https://github.com/PaulLeCam/react-leaflet
- Source: https://github.com/PaulLeCam/react-leaflet#readme
- Source: https://github.com/PaulLeCam/react-leaflet
- Source: https://github.com/PaulLeCam/react-leaflet/releases
- Source: https://react-leaflet.js.org
- Source: https://react-leaflet.js.org/docs/start-introduction

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
