Files
emaui/node_modules/@mantine/hooks/esm/use-throttled-state/use-throttled-state.mjs
2026-05-29 15:23:46 +03:00

14 lines
524 B
JavaScript

'use client';
import { useState, useEffect } from 'react';
import { useThrottledCallbackWithClearTimeout } from '../use-throttled-callback/use-throttled-callback.mjs';
function useThrottledState(defaultValue, wait) {
const [value, setValue] = useState(defaultValue);
const [setThrottledValue, clearTimeout] = useThrottledCallbackWithClearTimeout(setValue, wait);
useEffect(() => clearTimeout, []);
return [value, setThrottledValue];
}
export { useThrottledState };
//# sourceMappingURL=use-throttled-state.mjs.map