Skip to content

Commit f5a073a

Browse files
leiyangyoujamiebuilds
authored andcommitted
fix: cancel handleScroll on unmount (#5)
1 parent 0d935b8 commit f5a073a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function useWindowScrollPosition(options) {
3939
)
4040

4141
return () => {
42+
handleScroll.cancel()
4243
window.removeEventListener('scroll', handleScroll)
4344
}
4445
}, [])

0 commit comments

Comments
 (0)