Skip to content

Commit

Permalink
fix circularReplacer function references
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasyl Aleksashyn committed Apr 1, 2020
1 parent fa3de98 commit e80cc1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "with-memo",
"version": "1.0.0",
"version": "1.0.1",
"description": "HOC for React.memo with in-depth property comparison",
"author": "Vasyl Aleksashyn <vasyl.aleksashyn@gmail.com>",
"homepage": "https://github.com/aleksashyn/with-memo",
Expand Down
5 changes: 2 additions & 3 deletions src/deepEqual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ function getCircularReplacer(): (key: string, value: any) => any | undefined {
}

function deepEqual(prevProps: any, nextProps: any): boolean {
const circularReplacer = getCircularReplacer();
const stringifyLeft = JSON.stringify(prevProps, circularReplacer);
const stringifyRight = JSON.stringify(nextProps, circularReplacer);
const stringifyLeft = JSON.stringify(prevProps, getCircularReplacer());
const stringifyRight = JSON.stringify(nextProps, getCircularReplacer());
return stringifyLeft === stringifyRight;
}

Expand Down

0 comments on commit e80cc1e

Please sign in to comment.