MCPcopy Create free account
hub / github.com/adobe/react-spectrum / setRef

Function setRef

packages/react-aria/src/utils/mergeRefs.ts:48–54  ·  view source on GitHub ↗
(ref: Ref<T> | MutableRefObject<T> | null | undefined, value: T)

Source from the content-addressed store, hash-verified

46}
47
48function setRef<T>(ref: Ref<T> | MutableRefObject<T> | null | undefined, value: T) {
49 if (typeof ref === 'function') {
50 return ref(value);
51 } else if (ref != null) {
52 ref.current = value;
53 }
54}

Callers 1

mergeRefsFunction · 0.85

Calls 1

refFunction · 0.85

Tested by

no test coverage detected