@mantine/hooks
Version:
A collection of 50+ hooks for state and UI management
16 lines (12 loc) • 557 B
JavaScript
'use client';
;
var React = require('react');
var useThrottledCallback = require('../use-throttled-callback/use-throttled-callback.cjs');
function useThrottledState(defaultValue, wait) {
const [value, setValue] = React.useState(defaultValue);
const [setThrottledValue, clearTimeout] = useThrottledCallback.useThrottledCallbackWithClearTimeout(setValue, wait);
React.useEffect(() => clearTimeout, []);
return [value, setThrottledValue];
}
exports.useThrottledState = useThrottledState;
//# sourceMappingURL=use-throttled-state.cjs.map