Skip to content

Commit

Permalink
fix: useEventListener removeEventListener options
Browse files Browse the repository at this point in the history
Options passed to addEventListener and removeEventListener must match for the listener to be removed.
  • Loading branch information
marnusw authored and juliencrn committed Oct 13, 2022
1 parent cb47590 commit 6acb132
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useEventListener/useEventListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function useEventListener<

// Remove event listener on cleanup
return () => {
targetElement.removeEventListener(eventName, listener)
targetElement.removeEventListener(eventName, listener, options)
}
}, [eventName, element, options])
}
Expand Down

0 comments on commit 6acb132

Please sign in to comment.