[Feat] Support New Mapbox GL JS Interactions API (v3.9.0+)

Open
#2,551 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend, web-dev

Research direction

Start by reading the Mapbox GL JS v3.9+ Interactions API documentation linked in the issue, then inspect how react-map-gl currently exposes map.on/off event handling. Define the component or hook API around declarative targets and event callbacks. Done means the new interaction behavior is exposed without the proposed map.on/off boilerplate and supports the stated layer, featureset, or map targets.

Written by the indexing model from the issue text.

Description

feature
Target Use Case

Mapbox GL JS v3.9+ adds a new Interactions API (map.addInteraction() / map.removeInteraction()) for handling events declaratively on layers, featuresets, or the whole map.

This would remove the map.on/off boilerplate and make interactions reactive with props/state.

Proposal

It’d be great if react-map-gl exposed a simple component/hook for this, e.g.:

<Interaction
  type="click"
  target={{ layerId: 'my-layer' }}
  onEvent={(e) => console.log(e.feature)}
/>
Dominant language
TypeScript
Stars
8.5k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from visgl/react-map-gl

All issues in visgl/react-map-gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.