UNPKG

use-flex-wrap

Version:

<div align='center'> <a> <img width='200' src="logo.jpeg" alt='logo'> </a> </div>

30 lines (29 loc) 769 B
import { useRef as d, useState as a, useCallback as f, useEffect as l } from "react"; import { o as w, d as W, c as b, a as m } from "./options-DkQzU_Ju.js"; const S = (c) => { const { debounceTime: s } = { ...w, ...c }, e = d(null), [o, u] = a(!1), [i, p] = a(0), r = f(() => { if (!e.current) return; const { isWrap: t, wrapStage: n } = W(e.current); u(t), p(n); }, []); return l(() => { const t = m(r, s); if (e.current) { const { disconnect: n } = b( e.current, t ); return window.addEventListener("resize", t), () => { n(), window.removeEventListener("resize", t); }; } }, [s, r]), { ref: e, wrap: o, wrapStage: i, detectWrap: r }; }; export { S as useFlexWrap };