Skip to content

Commit

Permalink
fix: πŸ› just use any for setTimeout because of diff environments
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Dec 19, 2018
1 parent 8c66abe commit 55673cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/useDebounce.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useState, useEffect } from 'react';

const useDebounce = (fn: () => any, ms: number = 0, args: Array<any> = []) => {
const [timeout, setTimeoutVar] = useState<NodeJS.Timeout | null>(null);
const [timeout, setTimeoutVar] = useState<any>(null);

useEffect(() => {
// if args change then clear timeout
clearTimeout(timeout!);
clearTimeout(timeout);
const t = setTimeout(fn.bind(null, args), ms);
setTimeoutVar(t);
}, args);
Expand Down

0 comments on commit 55673cb

Please sign in to comment.