UNPKG

@joint/react

Version:

React bindings and hooks for JointJS to build interactive diagrams and graphs.

30 lines (29 loc) 1.08 kB
import { type Ref } from 'react'; /** * Custom hook to return children and children ref. Children must be a `HTML` or `SVG` element. * * It automatically merges internal and external refs. * @param children The children elements. * @param externalRef The external reference. * @group Hooks * @internal * @returns The element ref and the children with the ref. * @example * ```tsx * const { elementRef, elementChildren } = useChildrenRef(children, externalRef); * ``` * @private * @description * This hook is used to return children and children ref. Children must be a `HTML` or `SVG` element. */ export declare function useChildrenRef<HTMLOrSVG extends HTMLElement | SVGElement>(children: unknown, externalRef?: Ref<HTMLOrSVG>): { elementRef: import("react").RefObject<HTMLOrSVG | null>; svgChildren: null; elementChildren?: undefined; } | { elementRef: import("react").RefObject<HTMLOrSVG | null>; elementChildren: import("react").FunctionComponentElement<{ ref: (node: HTMLOrSVG | null) => void; }>; svgChildren?: undefined; };