@joint/react
Version:
React bindings and hooks for JointJS to build interactive diagrams and graphs.
15 lines (14 loc) • 661 B
TypeScript
import { type RefObject, type ForwardedRef } from 'react';
/**
* Custom hook to combine a forwarded ref with an internal ref.
* This is useful when you want to pass a ref to a component while also keeping a reference to the element internally.
* @private
* @param ref - The forwarded ref to combine with the internal ref.
* @returns A ref object that combines the forwarded ref and the internal ref.
* @example
* const MyComponent = forwardRef((props, ref) => {
* const combinedRef = useCombinedRef(ref);
* return <div ref={combinedRef}>Hello</div>;
* });
*/
export declare function useCombinedRef<T>(ref?: ForwardedRef<T>): RefObject<T | null>;