UNPKG

@liveblocks/react-ui

Version:

A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.

23 lines (20 loc) 472 B
import { useCallback } from 'react'; function applyRef(ref, value) { if (value) { if (typeof ref === "function") { ref(value); } else if (ref && "current" in ref) { ref.current = value; } } } function mergeRefs(value, ...refs) { for (const ref of refs) { applyRef(ref, value); } } function useRefs(...refs) { return useCallback((value) => mergeRefs(value, ...refs), refs); } export { useRefs }; //# sourceMappingURL=use-refs.js.map