UNPKG

ttk-app-core

Version:

@ttk/recat enterprise develop framework

13 lines (11 loc) 289 B
import { useState, useCallback } from 'react' // const [react, e] export function useClientRect() { const [rect, setRect] = useState(null); const ref = useCallback(node => { if (node !== null) { setRect(node.getBoundingClientRect()); } }, []); return [rect, ref]; }