# give/4.16.8.1/src/Views/Components/ListTable/hooks/useDebounce.ts

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.8.1. 15 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.8.1/code/src/Views/Components/ListTable/hooks/useDebounce.ts
- Raw: https://pluginprobe.com/plugins/give/4.16.8.1/raw/src/Views/Components/ListTable/hooks/useDebounce.ts
- Modified: 2025-03-31T19:17:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.8.1/code/src/Views/Components/ListTable/hooks/useDebounce.ts#L10-L20`.

```typescript
import {useEffect, useRef} from 'react';
import debounce from 'lodash.debounce';

export default function useDebounce(callback) {
    const debouncedCallback = useRef(debounce(callback, 500)).current;

    useEffect(() => {
        return () => {
            debouncedCallback.cancel();
        };
    }, []);

    return debouncedCallback;
}

```
