Skip to content

Commit 6acb132

Browse files
marnuswjuliencrn
authored andcommitted
fix: useEventListener removeEventListener options
Options passed to addEventListener and removeEventListener must match for the listener to be removed.
1 parent cb47590 commit 6acb132

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/useEventListener/useEventListener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function useEventListener<
7474

7575
// Remove event listener on cleanup
7676
return () => {
77-
targetElement.removeEventListener(eventName, listener)
77+
targetElement.removeEventListener(eventName, listener, options)
7878
}
7979
}, [eventName, element, options])
8080
}

0 commit comments

Comments
 (0)