- useClient(onError?): {
client: undefined | Client<any>;
disconnect: (() => Promise<void>);
error: null | Error;
initialize: ((__namedParameters: InitializeClientOptions) => Promise<undefined | Client<any>>);
isLoading: boolean;
} Parameters
Optional
onError: ((error: Error) => void)- (error): void
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
This hook allows you to initialize, disconnect, and access the XMTP client instance. It also exposes the error and loading states of the client.