Function useClient

This hook allows you to initialize, disconnect, and access the XMTP client instance. It also exposes the error and loading states of the client.

  • Parameters

    • OptionalonError: ((error: Error) => void)
        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns {
        client: undefined | Client<any>;
        disconnect: (() => Promise<void>);
        error: null | Error;
        initialize: ((__namedParameters: InitializeClientOptions) => Promise<undefined | Client<any>>);
        isLoading: boolean;
    }

    • client: undefined | Client<any>
    • disconnect: (() => Promise<void>)
        • (): Promise<void>
        • Returns Promise<void>

    • error: null | Error
    • initialize: ((__namedParameters: InitializeClientOptions) => Promise<undefined | Client<any>>)
        • (__namedParameters): Promise<undefined | Client<any>>
        • Parameters

          • __namedParameters: InitializeClientOptions

          Returns Promise<undefined | Client<any>>

    • isLoading: boolean