UNPKG

@useloops/design-system

Version:

The official React based Loops design system

2 lines (1 loc) 346 B
import{useRef as t,useState as e,useEffect as r}from"react";const n=(n=[])=>{const c=t(null),[s,o]=e(!1);return r(()=>{const t=()=>{const t=c.current;if(t){const e=t.scrollWidth>t.clientWidth;o(e)}};t();const e=new ResizeObserver(t);return c.current&&e.observe(c.current),()=>{e.disconnect()}},n),{textRef:c,isTruncated:s}};export{n as default};