SSE Hooks

useForkRef

GitHub
Merges refs into a single memoized callback ref or null.

Installation

npx sse-hooks add use-fork-ref

Usage

example.ts
import { useForkRef } from "./{hooks file}";

const rootRef = React.useRef<Instance>(null);
const refFork = useForkRef(rootRef, props.ref);

return <Root {...props} ref={refFork} />;

API

Parameters

Prop Default Type
refs-

Ref<Instance> | undefined[]

The ref array.

Returns

Return Value Default Type
return-

(instance: Instance | null) => void | () => VoidOrUndefinedOnly | null

Hook return value

Types Aliases

No specific type aliases defined for this component.

Changelog

81e9f — feat: update documentation and categorize hooks

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

2bd46 — feat: add useBattery and useClickAway hooks with supporting utilities

Built with Love • © 2026