mirror of
https://github.com/dathere/ckan-devstaller.git
synced 2025-11-09 21:39:49 +00:00
15 lines
319 B
TypeScript
15 lines
319 B
TypeScript
import type * as React from 'react';
|
|
|
|
export function mergeRefs<T>(
|
|
...refs: (React.Ref<T> | undefined)[]
|
|
): React.RefCallback<T> {
|
|
return (value) => {
|
|
refs.forEach((ref) => {
|
|
if (typeof ref === 'function') {
|
|
ref(value);
|
|
} else if (ref) {
|
|
ref.current = value;
|
|
}
|
|
});
|
|
};
|
|
}
|