useStableCallback

Returns a memoized callback with a stable reference that always invokes the latest version.

Returns a callback with a stable reference identity that always delegates to the latest version of the function. This avoids unnecessary re-renders and effect re-runs when passing callbacks as dependencies.

Import#

import { useStableCallback } from '@volue/wave-react';

Example#


API Reference#

Arguments#

Prop
Type
Default
callback
(...args: any[]) => any

Returns#

T — A function with a stable reference that delegates to the latest callback version when called.