import { useState, useEffect } from 'react';
function PHXUseDebounce(value, delay) {
    const [debounceValue, setDebounceValue] = useState(value);
    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;
}
export default PHXUseDebounce;
//# sourceMappingURL=useDebounce.js.map