usePublicClient
Hook for accessing viem's Public Client.
import { usePublicClient } from 'wagmi'Usage
import { usePublicClient } from 'wagmi'
function App() {
const publicClient = usePublicClient()
}Return Value
PublicClientConfiguration
chainId (optional)
Force a specific chain id. The wagmi Client's publicClient must be set up as a chain-aware function for this to work correctly.
import { usePublicClient } from 'wagmi'
function App() {
const publicClient = usePublicClient({
chainId: 1,
})
}