Skip to content

Latest commit

Β 

History

History
29 lines (20 loc) Β· 491 Bytes

useThrottle.md

File metadata and controls

29 lines (20 loc) Β· 491 Bytes

🍏 useThrottle

Throttles a value

Arguments

  • value: Any: The value to be throttled
  • ms: Number: The time in milliseconds to throttle

Returns

  • throttledValue: Any: The returned value after the throttling

Usage

import { useThrottle } from "react-recipes";

const App = ({ value }) => {
  const throttledValue = useThrottle(value, 250);

  return (
    <>
      <div>Value: {value}</div>
      <div>Throttled value: {throttledValue}</div>
    </>
  );
};