MCPcopy
hub / github.com/imbhargav5/rooks / setRef

Function setRef

packages/rooks/src/hooks/useMergeRefs.ts:5–11  ·  view source on GitHub ↗
(ref: PossibleRef<T>, value: T)

Source from the content-addressed store, hash-verified

3import type { PossibleRef } from "../utils/utils";
4
5function setRef<T>(ref: PossibleRef<T>, value: T) {
6 if (typeof ref === "function") {
7 ref(value);
8 } else if (ref !== null && ref !== undefined) {
9 (ref as MutableRefObject<T>).current = value;
10 }
11}
12
13/**
14 * useMergeRefs

Callers 1

useMergeRefsFunction · 0.70

Calls 1

refFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…