Skip to content

Instantly share code, notes, and snippets.

View sangwonl's full-sized avatar

gamz sangwonl

View GitHub Profile
import { useCallback, useEffect, useRef, useState } from 'react';
function debounce(callback: Function, delay = 300) {
let handle: number;
return function () {
if (handle) clearTimeout(handle);
handle = setTimeout(callback, delay);
};
}