Skip to main content

useWalletConnect

Hook for initiating a Wallet Connect connection prompt for the user.

import { useWalletConnect } from "@thirdweb-dev/react";

Usage

The hook returns a function that, when called, will launch the Wallet Connect popup.

import { useWalletConnect } from "@thirdweb-dev/react";

function App() {
const connectWithWalletConnect = useWalletConnect();

return (
<button onClick={connectWithWalletConnect}>Connect WalletConnect</button>
);
}

When the user clicks the button, a popup will appear prompting them to scan the QR code from their mobile wallet. Once the user scans the QR code from a Wallet Connect supported mobile wallet, their wallet will be connected to the page as expected.

You can then use the useAddress hook to get the address of the connected wallet.