Skip to content

Commit e55414b

Browse files
guoyunheliuyib
andauthored
refactor: replace lodash/isEqual with react-fast-compare (#2458)
* refactor: replace lodash/isEqual with react-fast-compare * chore: update lock --------- Co-authored-by: 云泥 <1656081615@qq.com>
1 parent dfc55d8 commit e55414b

File tree

7 files changed

+15
-5
lines changed

7 files changed

+15
-5
lines changed

packages/hooks/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"intersection-observer": "^0.12.0",
3939
"js-cookie": "^2.x.x",
4040
"lodash": "^4.17.21",
41+
"react-fast-compare": "^3.2.2",
4142
"resize-observer-polyfill": "^1.5.1",
4243
"screenfull": "^5.0.0",
4344
"tslib": "^2.4.1"

packages/hooks/src/useDeepCompareEffect/index.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav:
55

66
# useDeepCompareEffect
77

8-
Usage is the same as `useEffect`, but deps are compared with [lodash.isEqual](https://lodash.com/docs/4.17.15#isEqual).
8+
Usage is the same as `useEffect`, but deps are compared with [react-fast-compare](https://www.npmjs.com/package/react-fast-compare).
99

1010
## Examples
1111

packages/hooks/src/useDeepCompareEffect/index.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav:
55

66
# useDeepCompareEffect
77

8-
用法与 useEffect 一致,但 deps 通过 [lodash isEqual](https://lodash.com/docs/4.17.15#isEqual) 进行深比较。
8+
用法与 useEffect 一致,但 deps 通过 [react-fast-compare](https://www.npmjs.com/package/react-fast-compare) 进行深比较。
99

1010
## 代码演示
1111

packages/hooks/src/useDeepCompareLayoutEffect/index.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav:
55

66
# useDeepCompareLayoutEffect
77

8-
Usage is the same as `useLayoutEffect`, but deps are compared with [lodash.isEqual](https://lodash.com/docs/4.17.15#isEqual).
8+
Usage is the same as `useLayoutEffect`, but deps are compared with [react-fast-compare](https://www.npmjs.com/package/react-fast-compare).
99

1010
## Examples
1111

packages/hooks/src/useDeepCompareLayoutEffect/index.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav:
55

66
# useDeepCompareLayoutEffect
77

8-
用法与 useLayoutEffect 一致,但 deps 通过 [lodash isEqual](https://lodash.com/docs/4.17.15#isEqual) 进行深比较。
8+
用法与 useLayoutEffect 一致,但 deps 通过 [react-fast-compare](https://www.npmjs.com/package/react-fast-compare) 进行深比较。
99

1010
## 代码演示
1111

packages/hooks/src/utils/depsEqual.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { DependencyList } from 'react';
2-
import isEqual from 'lodash/isEqual';
2+
import isEqual from 'react-fast-compare';
33

44
export const depsEqual = (aDeps: DependencyList = [], bDeps: DependencyList = []) =>
55
isEqual(aDeps, bDeps);

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)