Throttling Frequent Data in React
In this post we will make a custom hook that will update state on a set interval, even if it is passed new data 60 times per second
![Throttling Frequent Data in React Throttling Frequent Data in React](https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c47aaab-89ff-4be0-baf9-3363bd16177d_1430x804.png)
I have a somewhat unique problem. I have a function being called 60 times per second, and it never stops being called. Most examples for throttling or debouncing only invoke the function after a rest period. In the case of an ARKit session, this never ends. The function is called constantly.
In this post we will be making a small hook that will store dat…
Keep reading with a 7-day free trial
Subscribe to zach.codes to keep reading this post and get 7 days of free access to the full post archives.