useConnectionStatus
Hook for checking whether your app is connected to a wallet.
import { useConnectionStatus } from "@thirdweb-dev/react";
Usage
import { useConnectionStatus } from "@thirdweb-dev/react";
function App() {
const connectionStatus = useConnectionStatus();
if (connectionStatus === "unknown") return <p> Loading... </p>;
if (connectionStatus === "connecting") return <p> Connecting... </p>;
if (connectionStatus === "connected") return <p> You are connected </p>;
if (connectionStatus === "disconnected")
return <p> You are not connected to a wallet </p>;
}
Return Value
Return Value
unknown
: Application has not yet determined connection status.connecting
: Application is trying to connect to a wallet. Either because of a user action, or when autoconnect set totrue
.connected
: Application is connected to a wallet.disconnected
: Application is not connected to any wallet.
"unknown" | "connecting" | "connected" | "disconnected";