useAddress
Hook for getting the currently connected wallet address.
Returns undefined
if no wallet is connected.
import { useAddress } from "@thirdweb-dev/react";
const address = useAddress();
Usage
Call the hook to get the current wallet address.
import { useAddress } from "@thirdweb-dev/react";
function App() {
const address = useAddress();
if (!address) return <div>No wallet connected</div>;
return <div>My wallet address is {address}</div>;
}
Return value
Return Value
string | undefined;
- Returns a
string
containing the wallet address. - Returns
undefined
if no wallet is connected.