@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
24 lines (23 loc) • 671 B
JavaScript
"use client";
import * as __rspack_external_react from "react";
function useTimeout(callback, delay) {
const savedCallbackRef = __rspack_external_react.useRef(callback);
__rspack_external_react.useLayoutEffect(()=>{
savedCallbackRef.current = callback;
}, [
callback
]);
__rspack_external_react.useEffect(()=>{
if (null === delay) return;
const timeoutId = globalThis.setTimeout(()=>{
savedCallbackRef.current();
}, delay);
return ()=>{
globalThis.clearTimeout(timeoutId);
};
}, [
delay
]);
}
export { useTimeout };
//# sourceMappingURL=useTimeout.js.map