Why map.off doesnt work correctly mapboxGL JS

Viewed 30

i create eventListener with

map.on('mousemove', (event) => handlerValues(event))

i must use event in handlerValues, but when i use

map.off('mousemove', (event) => handlerValues(event)) it doesn't work

i wrapped handlerValues in useCallback, but nothing has changed

1 Answers

i find solution, that's crutch but you can use .filter on map._listeners.mousemove, and remove listener which you want delete

Related