Closed Alexnortung closed 1 year ago
useControl
calls map.removeControl
on unmount, which is the correct behavior for strict mode. Some native controls, such as GeolocateControl in your example, do not properly remove their async operation callbacks on removal. See https://github.com/visgl/react-map-gl/blob/7.1-release/src/components/geolocate-control.ts#L46
Description
the
useControl
hook creates the control twice when using strict mode.It seems like an incorrect use of
useMemo
Expected Behavior
I would expect the hook to correctly remove the control on unmount.
Steps to Reproduce
https://codesandbox.io/s/cranky-dust-t7l97m?file=/src/index.js
Environment
Logs
No response