Skip to content

Commit

Permalink
useScroll cancel animation frame in handler
Browse files Browse the repository at this point in the history
  • Loading branch information
wardoost committed Mar 25, 2019
1 parent 4011e02 commit 7b3e4d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const useScroll = (ref): State => {

useEffect(() => {
const handler = () => {

cancelAnimationFrame(frame.current)
frame.current = requestAnimationFrame(() => {
setState({
x: ref.current.scrollLeft,
Expand Down

0 comments on commit 7b3e4d3

Please sign in to comment.