function useCommand<TArgs extends readonly unknown[], TReturn>(command: (...args: TArgs) => TReturn): CommandHandle<TArgs, Awaited<TReturn>>; Tracks a command's pending state and failure for rendering. run always calls the latest command, so it may close over the current client. Unmounting disposes the controller: pending, error and failure stop updating, while a run still in flight resolves as usual.
const increment = useCommand(() => client?.increment());
<button disabled={!client || increment.pending} onClick={() => increment.run()}>…</button>