Skip to content

Instantly share code, notes, and snippets.

@cmaciasjimenez
cmaciasjimenez / debounce.js
Created May 31, 2023 22:10 — forked from sachinKumarGautam/debounce.js
How to use debounce function in react without lodash
function debounce (fn, time) {
let timeoutId
return wrapper
function wrapper (...args) {
if (timeoutId) {
clearTimeout(timeoutId)
}
timeoutId = setTimeout(() => {
timeoutId = null