useDebounce

Delay the execution of function or state update.

Usage

import React, { useState } from "react";
import useDebounce from 'funda-ui/Utils/useDebounce';
 
const App = () => {
    const [count, setCount] = useState(0);
    const handleClick = useDebounce(() => setCount(count + 1), 500, [count]);
 
    return (
        <div className="app">
            <button onClick={handleClick}>click</button>
            <p>click {count} time</p>
        </div>
    );
};