@ark-ui/react
Version:
A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.
22 lines (17 loc) • 490 B
JavaScript
'use client';
;
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const react = require('react');
function useDebounce(value, delay) {
const [debouncedValue, setDebouncedValue] = react.useState(value);
react.useEffect(() => {
const timer = setTimeout(() => {
setDebouncedValue(value);
}, delay);
return () => {
clearTimeout(timer);
};
}, [value, delay]);
return debouncedValue;
}
exports.useDebounce = useDebounce;