• Create a reusable hook that acquires a tracked ref on each call.

    Unlike createServiceHook (which returns the raw service), this returns a ServiceRef<T> that must be released.

    Type Parameters

    • T

    Parameters

    Returns (() => ServiceRef<T>)

    A function () => ServiceRef<T>.

    1.2.0

    const useRpcRef = createRefHook(Tokens.RPC);

    // In a component:
    const rpcRef = useRpcRef();
    await rpcRef.current.getBalance(pubkey);
    rpcRef.release();