From 55d75005bc26aa41cddc090273f82aa106729fb8 Mon Sep 17 00:00:00 2001 From: BIKI DAS Date: Mon, 11 Oct 2021 18:50:15 +0530 Subject: [PATCH] duplicate value in variable (#22390) --- packages/shared/shallowEqual.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/shared/shallowEqual.js b/packages/shared/shallowEqual.js index 92c66e5a1ece6..33d0004eb45fe 100644 --- a/packages/shared/shallowEqual.js +++ b/packages/shared/shallowEqual.js @@ -38,9 +38,10 @@ function shallowEqual(objA: mixed, objB: mixed): boolean { // Test for A's keys different from B. for (let i = 0; i < keysA.length; i++) { + const currentKey = keysA[i]; if ( - !hasOwnProperty.call(objB, keysA[i]) || - !is(objA[keysA[i]], objB[keysA[i]]) + !hasOwnProperty.call(objB, currentKey) || + !is(objA[currentKey], objB[currentKey]) ) { return false; }