export default function useDebounce(callback, delay = 300) {
  let timeout

  const debounced = (...args) => {
    if (timeout) clearTimeout(timeout)
    timeout = setTimeout(() => callback(...args), delay)
  }

  return debounced
}
