useChainId
Hook for retrieving the chain ID of the network the user is connected to.
import { useChainId } from "@thirdweb-dev/react";
Usage
import { useChainId } from "@thirdweb-dev/react";
function App() {
const chainId = useChainId();
return <div>{chainId}</div>;
}
Return value
A number
representing the current chain id, or undefined
if the chain id could not be found.
number | undefined;