• React
  • WagmiConfig

WagmiConfig

The WagmiConfig component manages configuration for all hooks using React Context.

import { WagmiConfig } from 'wagmi'

Usage

import { WagmiConfig } from 'wagmi'
 
function App() {
  return (
    <WagmiConfig>
      <YourRoutes />
    </WagmiConfig>
  )
}

Configuration

config

A wagmi config instance that consists of configuration options. Defaults to createConfig().

import { WagmiConfig, createConfig, configureChains, mainnet } from 'wagmi'
import { publicProvider } from 'wagmi/providers/public'
 
const { publicClient, webSocketPublicClient } = configureChains(
  [mainnet],
  [publicProvider()],
)
 
const config = createConfig({
  publicClient,
  webSocketPublicClient,
})
 
function App() {
  return (
    <WagmiConfig config={config}>
      <YourRoutes />
    </WagmiConfig>
  )
}