Docs

useSwitchActiveWalletChain

Switch to blockchain with given chain id in the active wallet.

Example

import { useSwitchActiveWalletChain } from "thirdweb/react";
import { sepolia } from "thirdweb/chains";
const switchChain = useSwitchActiveWalletChain();
// later in your code
<button onClick={() => switchChain(sepolia)}>Switch Chain</button>;

Returns

A function to switch to blockchain with given chain id in the active wallet.