Memoize refs

Refs can be memoized following the fix in the previous commit.

Fix #1755
Fix #1665
This commit is contained in:
Nicolas Gallagher
2020-10-07 14:42:22 -07:00
parent b4322734a2
commit 583e16fa8d

View File

@@ -12,5 +12,9 @@ import mergeRefs from '../mergeRefs';
export default function useMergeRefs(...args: $ReadOnlyArray<React.ElementRef<any>>) {
// TODO(memoize) #1755
return /*React.useMemo(() => */ mergeRefs(...args) /*, [args])*/;
return React.useMemo(
() => mergeRefs(...args),
// eslint-disable-next-line
[...args]
);
}