useChainId
Hook for accessing the chain ID of the network the current wallet is connected to
Example
Returns
A number representing the current chain id, or undefined if the user is not connected to a wallet.
For Example, if the user is connected to the Ethereum Mainnet, the return value will be 1 .