From 583e16fa8d6f53fd8234944cb2beb94a9c2293b8 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Wed, 7 Oct 2020 14:42:22 -0700 Subject: [PATCH] Memoize refs Refs can be memoized following the fix in the previous commit. Fix #1755 Fix #1665 --- packages/react-native-web/src/modules/useMergeRefs/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native-web/src/modules/useMergeRefs/index.js b/packages/react-native-web/src/modules/useMergeRefs/index.js index 73d8d94ab..01837c2b6 100644 --- a/packages/react-native-web/src/modules/useMergeRefs/index.js +++ b/packages/react-native-web/src/modules/useMergeRefs/index.js @@ -12,5 +12,9 @@ import mergeRefs from '../mergeRefs'; export default function useMergeRefs(...args: $ReadOnlyArray>) { // TODO(memoize) #1755 - return /*React.useMemo(() => */ mergeRefs(...args) /*, [args])*/; + return React.useMemo( + () => mergeRefs(...args), + // eslint-disable-next-line + [...args] + ); }