Skip to main content

useSigner

Hook for getting the current signer of the connected wallet, if one is available.

Useful if you want to instantiate an instance of the ThirdwebSDK with the signer of the connected wallet in the TypeScript SDK, or using other web3 libraries that require a signer such as Ethers with the React SDK.

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

const signer = useSigner();

Usage

Returns the Signer of the connected wallet, if one is available.

If no wallet is connected, returns undefined.

import { useSigner, Web3Button } from "@thirdweb-dev/react";

function App() {
const signer = useSigner();
}

Return Value

Return Value

The hook's return type is Signer | undefined where Signer is the EthersJS signer instance.

Signer | undefined;