Skip to content

Instantly share code, notes, and snippets.

View WebD00D's full-sized avatar
💻
pushing pixels

Christian Bryant WebD00D

💻
pushing pixels
View GitHub Profile
@WebD00D
WebD00D / debounce.ts
Created October 9, 2019 00:17
Debounce React Hook
import React, { useState, useEffect } from 'react';
const debounce = (value, delay) => {
// State and setters for debounced value
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(
() => {
// Set debouncedValue to value (passed in) after the specified delay