Skip to content

Instantly share code, notes, and snippets.

View Bouab-Ahmed's full-sized avatar
🎯
Focusing

BOUAB Ahmed Bouab-Ahmed

🎯
Focusing
  • Elbayadh,Algeria
View GitHub Profile
@Bouab-Ahmed
Bouab-Ahmed / useDebounce.ts
Created December 11, 2024 14:58 — forked from KristofferEriksson/useDebounce.ts
A React Typescript hook that allows you to debounce any fast changing value
import { useEffect, useState } from "react";
/**
* useDebounce hook
* This hook allows you to debounce any fast changing value. The debounced value will only
* reflect the latest value when the useDebounce hook has not been called for the specified delay period.
*
* @param value - The value to be debounced.
* @param delay - The delay in milliseconds for the debounce.
* @returns The debounced value.