Skip to content

Commit

Permalink
feat: update dequal to v2 (Set support)
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
kentcdodds committed Aug 19, 2020
1 parent c6ca6f4 commit 23e4070
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
"author": "Kent C. Dodds <[email protected]> (https://kentcdodds.com)",
"license": "MIT",
"peerDependencies": {
"react": ">=16.12"
"react": ">=16.13"
},
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.11.2",
"@types/use-deep-compare-effect": "^1.2.0",
"dequal": "^1.0.0"
"dequal": "^2.0.2"
},
"devDependencies": {
"@testing-library/react-hooks": "^3.2.1",
"@testing-library/react-hooks": "^3.4.1",
"jest-in-case": "^1.0.2",
"kcd-scripts": "^5.6.0",
"kcd-scripts": "^6.2.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-test-renderer": "^16.13.1"
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import deepEqual from 'dequal'
import {dequal as deepEqual} from 'dequal'

function checkDeps(deps) {
if (!deps || !deps.length) {
Expand Down Expand Up @@ -32,10 +32,12 @@ function useDeepCompareEffect(callback, dependencies) {
if (process.env.NODE_ENV !== 'production') {
checkDeps(dependencies)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
React.useEffect(callback, useDeepCompareMemoize(dependencies))
}

export function useDeepCompareEffectNoCheck(callback, dependencies) {
// eslint-disable-next-line react-hooks/exhaustive-deps
React.useEffect(callback, useDeepCompareMemoize(dependencies))
}

Expand Down

0 comments on commit 23e4070

Please sign in to comment.