fix: React.memo resolvers not accounting for all props (#6042)
This commit is contained in:
12
src/utils.ts
12
src/utils.ts
@ -709,3 +709,15 @@ export const ReactChildrenToObject = <
|
||||
return acc;
|
||||
}, {} as Partial<T>);
|
||||
};
|
||||
|
||||
export const isShallowEqual = <T extends Record<string, any>>(
|
||||
objA: T,
|
||||
objB: T,
|
||||
) => {
|
||||
const aKeys = Object.keys(objA);
|
||||
const bKeys = Object.keys(objA);
|
||||
if (aKeys.length !== bKeys.length) {
|
||||
return false;
|
||||
}
|
||||
return aKeys.every((key) => objA[key] === objB[key]);
|
||||
};
|
||||
|
Reference in New Issue
Block a user