File tree Expand file tree Collapse file tree 6 files changed +6
-5
lines changed
useDeepCompareLayoutEffect Expand file tree Collapse file tree 6 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 38
38
"intersection-observer" : " ^0.12.0" ,
39
39
"js-cookie" : " ^2.x.x" ,
40
40
"lodash" : " ^4.17.21" ,
41
+ "react-fast-compare" : " ^3.2.2" ,
41
42
"resize-observer-polyfill" : " ^1.5.1" ,
42
43
"screenfull" : " ^5.0.0" ,
43
44
"tslib" : " ^2.4.1"
Original file line number Diff line number Diff line change 5
5
6
6
# useDeepCompareEffect
7
7
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 ) .
9
9
10
10
## Examples
11
11
Original file line number Diff line number Diff line change 5
5
6
6
# useDeepCompareEffect
7
7
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 ) 进行深比较。
9
9
10
10
## 代码演示
11
11
Original file line number Diff line number Diff line change 5
5
6
6
# useDeepCompareLayoutEffect
7
7
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 ) .
9
9
10
10
## Examples
11
11
Original file line number Diff line number Diff line change 5
5
6
6
# useDeepCompareLayoutEffect
7
7
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 ) 进行深比较。
9
9
10
10
## 代码演示
11
11
Original file line number Diff line number Diff line change 1
1
import type { DependencyList } from 'react' ;
2
- import isEqual from 'lodash/isEqual ' ;
2
+ import isEqual from 'react-fast-compare ' ;
3
3
4
4
export const depsEqual = ( aDeps : DependencyList = [ ] , bDeps : DependencyList = [ ] ) =>
5
5
isEqual ( aDeps , bDeps ) ;
You can’t perform that action at this time.
0 commit comments