Function useChainId

  • Hook for accessing the chain ID of the network the current wallet is connected to

    import { useChainId } from "@thirdweb-dev/react"
    

    Returns number | undefined

    Example

    You can get the chain ID of the connected wallet by using the hook as follows:

    import { useChainId } from "@thirdweb-dev/react"

    const App = () => {
    const chainId = useChainId()

    return <div>{chainId}</div>
    }

    See

    Documentation

Generated using TypeDoc