AutoConnect

AutoConnect last connected wallet on page reload or revisit. Note: If you are using ConnectButton or ConnectEmbed components, You don't need to use this component as it is already included.

This is useful if you are manually connecting the wallets using the useConnect hook and want to auto connect the last connected wallets on page reload or revisit.

You can also use the useAutoConnect hook to achieve the same result.

To check if the wallet in in the process of auto connecting, you can use the useIsAutoConnecting hook.

Example

import { AutoConnect } from "thirdweb/react";
import { createWallet, inAppWallet } from "thirdweb/wallets";
// list of wallets that your app uses
const wallets = [
inAppWallet(),
createWallet("io.metamask"),
createWallet("me.rainbow"),
];
function Example() {
return (
<AutoConnect
wallets={wallets}
client={client}
appMetadata={appMetadata}
/>
);
}
function AutoConnect(props: AutoConnectProps): Element;

Parameters

Object of type AutoConnectProps . Refer to AutoConnectProps

Type

let props: {
accountAbstraction?: SmartWalletOptions;
appMetadata?: AppMetadata;
chain?: Chain;
client: ThirdwebClient;
onConnect?: (wallet: Wallet) => void;
timeout?: number;
wallets?: Array<Wallet>;
};

Returns

let returnType: Element;