• Core
  • Actions
  • watchNetwork

watchNetwork

Action for subscribing to network changes.

import { watchNetwork } from '@wagmi/core'

Usage

By default, the callback will be invoked when network changes.

import { watchNetwork } from '@wagmi/core'
 
const unwatch = watchNetwork((network) => console.log(network))

Return Value

unwatch is a function that can be called to unsubscribe from the network change event.