Create a function that runs at most once per interval, with a trailing call.
This is custom React hooks, you need to follow the Basic Rules when you use it.
Move the mouse over the box, the position updates at most every 200ms.
const useThrottledCallback = <A extends unknown[]>(
callback: (...args: A) => void,
wait: number,
) => ((...args: A) => void) & { cancel: () => void }