Hooks

useThrottle

Publisher

cermuel

50 hooks published

More from this publisher

useThrottle

Limit how often a value updates.

useThrottle.tsx
import { useState } from "react";import { useThrottle } from "@cermuel/hooks/react";export function useThrottleExample() {  const [search, setSearch] = useState("");  const value = useThrottle(search, 300);  return <input value={value} onChange={(event) => setSearch(event.target.value)} />;}

Props

Param
Type
Default Value
value
T
delay?
number
250

Returns

T