MCPcopy Create free account
hub / github.com/ampproject/amphtml / setRef

Function setRef

src/preact/utils.js:23–29  ·  view source on GitHub ↗

* @param {import('preact').Ref } ref * @param {T} value * @template T

(ref, value)

Source from the content-addressed store, hash-verified

21 * @template T
22 */
23function setRef(ref, value) {
24 if (typeof ref === 'function') {
25 ref(value);
26 } else if (ref) {
27 ref.current = value;
28 }
29}
30
31/**
32 * Combines refs to pass into `ref` prop.

Callers 1

useMergeRefsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected