useNetworkMismatch
Hook for checking whether the connected wallet is currently on the correct chain,
i.e. the chain specified in the activeChain
on the ThirdwebProvider
.
import { useNetworkMismatch } from "@thirdweb-dev/react";
const isMismatched = useNetworkMismatch();
Usage
Call the hook to get a boolean value indicating whether the connected wallet is on the correct chain.
import { useNetworkMismatch } from "@thirdweb-dev/react";
const App = () => {
const isMismatched = useNetworkMismatch();
};
Using this value, you can prompt users to switch their network using the useNetwork
hook.
Return Value
Return Value
Returns true
if the chainId
of the connected wallet is different from the chainId
of the activeChain
on the </ThirdwebProvider
.
boolean;