import { useState, useLayoutEffect } from 'react';
import { subscribe } from './resizeObserverService';
/**
 * useResizeSignal
 * The hook "pokes" the component whenever a resize happens.
 */
export const useResizeSignal = (ref) => {
    const [signal, setSignal] = useState(0);
    useLayoutEffect(() => {
        const el = ref.current;
        if (!el)
            return;
        const unsubscribe = subscribe(el, () => setSignal((s) => s + 1));
        return unsubscribe;
    }, [ref]);
    return signal;
};
//# sourceMappingURL=useResizeSignal.js.map