Skip to content

Commit f0d37aa

Browse files
authored
Fix useDidUpdate dependencies type (#1506)
1 parent 953faf0 commit f0d37aa

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { DependencyList } from 'react';
12
/**
23
* This hook avoid calling useEffect on the initial value of his dependency array
34
*/
4-
declare const useDidUpdate: (callback: () => void, dep: [any]) => void;
5+
declare const useDidUpdate: (callback: () => void, dep: DependencyList) => void;
56
export default useDidUpdate;

src/hooks/useDidUpdate/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {useEffect, useRef} from 'react';
1+
import {useEffect, useRef, DependencyList} from 'react';
22

33
/**
44
* This hook avoid calling useEffect on the initial value of his dependency array
55
*/
6-
const useDidUpdate = (callback: () => void, dep: [any]) => {
6+
const useDidUpdate = (callback: () => void, dep: DependencyList) => {
77
const isMounted = useRef<boolean>(false);
88

99
useEffect(() => {

0 commit comments

Comments
 (0)