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

Function useMergeRefs

src/preact/utils.js:36–48  ·  view source on GitHub ↗
(refs)

Source from the content-addressed store, hash-verified

34 * @return {import('preact').Ref<*>}
35 */
36export function useMergeRefs(refs) {
37 return useCallback(
38 /** @param {Element} element */
39 (element) => {
40 for (let i = 0; i < refs.length; i++) {
41 setRef(refs[i], element);
42 }
43 },
44 // refs is an array, but ESLint cannot statically verify it
45 // eslint-disable-next-line react-hooks/exhaustive-deps
46 refs
47 );
48}
49
50/**
51 * Required to use `props` whose name would be usually be mapped in

Callers

nothing calls this directly

Calls 1

setRefFunction · 0.85

Tested by

no test coverage detected