useDelay()
function useDelay(): {
cancel: () => void;
isPending: () => boolean;
schedule: (callback, milliseconds) => void;
};
Manage one delayed callback. Scheduling again replaces the pending callback, and unmounting cancels it. Returned methods are stable across renders.
Returns
{
cancel: () => void;
isPending: () => boolean;
schedule: (callback, milliseconds) => void;
}
| Name | Type |
|---|---|
cancel() | () => void |
isPending() | () => boolean |
schedule() | (callback, milliseconds) => void |