mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-27 15:30:57 +00:00
16 lines
557 B
JavaScript
16 lines
557 B
JavaScript
'use client';
|
|
'use strict';
|
|
|
|
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
|