Re:Scheduling in React
by exogen on Thursday March 07, 2019 @07:20PM
(#19334002)
In addition to everyone else's comments, there's another big problem: browsers treat setTimeout delays as very loose suggestions.
If you're scrolling when one of these timeouts is set, or one starts and then you start scrolling, it's possible for the browser to delay the callback for a super noticeable amount of time, on the order of 3–10 seconds (about a thousand times slower than you intended).
If you're scrolling when one of these timeouts is set, or one starts and then you start scrolling, it's possible for the browser to delay the callback for a super noticeable amount of time, on the order of 3–10 seconds (about a thousand times slower than you intended).