Piplup
@piplup/utilsHooks

useForkRef

Hook to combine multiple refs into a single ref callback.

import { useForkRef } from "@piplup/utils";

function Component({ externalRef }) {
  const localRef = React.useRef(null);
  const combined = useForkRef(localRef, externalRef);

  return <div ref={combined} />;
}

Props

Prop

Type

Return value

Prop

Type

On this page