Skip to content

Commit

Permalink
Memoize refs
Browse files Browse the repository at this point in the history
Refs can be memoized following the fix in the previous commit.

Fix necolas#1755
Fix necolas#1665
  • Loading branch information
necolas committed Oct 7, 2020
1 parent ac842aa commit 031caf9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/modules/useMergeRefs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
}

0 comments on commit 031caf9

Please sign in to comment.