Experimental
const { client, disconnect, isLoading, error, initialize } = useXmtpClient();
const handleConnect = async () => {
await initialize();
};
if (isLoading) return 'Loading...';
if (error) return 'Error';
if (!client) {
return (
<button type="button" onClick={handleConnect}>
Connect to XMTP
</button>
);
}
Initialize XMTP client using the same Signer as the one provided with
LensConfig
. Store XMTP user's decryption key in storage to improve UX. Be aware that XMTP user's key must be stored safely.You MUST be authenticated via
useLogin
to use this hook.