Composed Refs
Cached companion to composeRefs. Returns a stable ref callback so React does not detach and re-attach composed refs on every commit.
Installation
dgadd ships in @diffgazer/add on npm: pnpm add -D @diffgazer/add puts it on pnpm exec, and npx @diffgazer/add runs it without the install.
UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS from the installed package.
Parameters
Returns
Notes
Use at render sites
Use useComposedRefs in components that need to merge an internal ref with a consumer ref. Calling composeRefs inline creates a new callback every render.
Dependency model
The hook keys its callback on the individual ref identities, so pass stable refs from useRef or stable callback refs.
Source
Highlighted source loads after this disclosure opens. Browse the source repository.