useConnect
Connect A Wallet Without the Connect Wallet UI
The useConnect
hook allows you to programmatically connect to the wallet. You will need to build your own UI for connecting the wallet.
import { useConnect, metamaskWallet } from "@thirdweb-dev/react";
const metamask = metamaskWallet();
function App() {
const connect = useConnect();
return (
<button
onClick={async () => {
const wallet = await connect(metamask, connectOptions);
console.log("connected to ", wallet);
}}
>
Connect to MetaMask
</button>
);
}