UNPKG

rfa

Version:

**React Form Architect** is an ultimate solution for creating and rendering forms in React. Its main focus is to provide users with a tool to define, render and share a form in a browser.

15 lines (12 loc) 418 B
import React from "react"; export const useClientRect = () => { const [rect, setRect] = React.useState<ClientRect>(); const [nodeElement, setNodeElement] = React.useState<HTMLElement>(); const ref = React.useCallback((node: HTMLElement | null) => { if (node !== null) { setRect(node.getBoundingClientRect()); setNodeElement(node); } }, []); return [rect, ref, nodeElement] as const; };