How to use debounce and throttle and abstract them into hooks