Skip to content

Commit 7b3e4d3

Browse files
committed
useScroll cancel animation frame in handler
1 parent 4011e02 commit 7b3e4d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/useScroll.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const useScroll = (ref): State => {
1515

1616
useEffect(() => {
1717
const handler = () => {
18-
18+
cancelAnimationFrame(frame.current)
1919
frame.current = requestAnimationFrame(() => {
2020
setState({
2121
x: ref.current.scrollLeft,

0 commit comments

Comments
 (0)