๐ useThrottle
January 9, 2020 ยท View on GitHub
Throttles a value
Arguments
value: Any: The value to be throttledms: 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>
</>
);
};