Docs
/Getting Started
Getting Started
Installation
Install wagmi and its ethers peer dependency.
npm install wagmi ethersQuick Start
First, create a wagmi Client instance using createClient.
import { createClient } from 'wagmi'
const client = createClient()💡
You can pass a configuration object to createClient to customize the
Client's properties. Properties, like auto-connect, wallet connectors,
ethers.js provider, and more, are all configurable.
Next, wrap your app with the Provider component, passing client to it.
import { Provider, createClient } from 'wagmi'
const client = createClient()
function App() {
  return (
    <Provider client={client}>
      <YourRoutes />
    </Provider>
  )
}Finally, use hooks! Every component inside the Provider is now set up to use the wagmi hooks.
import { useAccount, useConnect } from 'wagmi'
function Profile() {
  const { data } = useAccount({ ens: true })
  const { connectors, connect } = useConnect()
  if (data?.address)
    return <div>Connected to {data.ens?.name ?? data.address}</div>
  return <button onClick={() => connect(connectors[0])}>Connect Wallet</button>
}Want to learn more? Check out the examples to learn how to use wagmi in real-world scenarios or continue on reading the documentation.