"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
function PHXUseDebounce(value, delay) {
    const [debounceValue, setDebounceValue] = (0, react_1.useState)(value);
    (0, react_1.useEffect)(() => {
        const handler = setTimeout(() => {
            setDebounceValue(value);
        }, delay);
        return () => clearTimeout(handler);
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [value]); // delay ko thay đổi
    return debounceValue;
}
exports.default = PHXUseDebounce;
//# sourceMappingURL=useDebounce.js.map