Skip to content

useDisconnect

Usage

useConnect must be called and a connection must be initiated before you can deploy a program.

Disconnects a dApp from the Puzzle Wallet. An active connection must be in place for disconnect to work.

import { useConnect, useDisconnect } from '@puzzlehq/sdk';
const { account } = useAccount();
const { disconnect, error, loading } = useDisconnect();
const isConnected = !!account;
return (
<div>
<button
onClick={() => {
if (isConnected) disconnect();
}}
disabled={loading}
>
disconnect
</button>
{error && <p>error disconnecting your dApp: {error}</p>}
{loading && <p>disconnecting your dApp...</p>}
</div>
)