Wagmi is a React hooks library for Ethereum development. Same team that built Viem. It solves the annoying parts of Web3 dev: wallet connections, state management, and TypeScript support that actually works.
Instead of fighting with wallet provider bullshit and transaction state management, you just use hooks like useAccount()
, useBalance()
, and useWriteContract()
. If you know React hooks, you know Wagmi. No more spending 6 hours debugging why MetaMask won't connect or why your transaction is stuck pending forever.
The Stack That Actually Works
Wagmi is built on three things that don't suck:
Viem - Way faster than Ethers.js and smaller bundles. In my testing, contract calls are noticeably snappier. Bundle size is about 60% smaller than equivalent Ethers.js implementations.
TanStack Query - Handles caching so your app doesn't spam RPC calls. Background updates, request deduplication, all that good stuff. Prevents the "Provider not found" error that ruins your day.
React Hooks - If you've used useState
and useEffect
, you already know how to use Wagmi.
The modular design means you only bundle what you use. Need just wallet connections? Cool. Want contract interactions? Add that. No need to ship the entire Web3 universe to your users.
TypeScript That Doesn't Fight You
The TypeScript support actually works. Give Wagmi your contract ABI and it'll infer function parameters, return types, everything. No more "Cannot call function transfer with args (string, string)" errors at runtime because you passed a string where it wanted a BigInt.
Error handling doesn't suck either. When a transaction fails, you get actual useful information: "Transaction failed: insufficient funds for gas * price + value" instead of the cryptic "execution reverted" nonsense.
Multi-chain support is built in. Your app can switch between Ethereum, Polygon, Arbitrum without you manually managing different providers. The library handles the network switching prompts and keeps everything synced.
Performance is solid. Request batching means fewer RPC calls (goodbye Alchemy rate limits), caching prevents redundant requests, and tree-shaking keeps your bundle reasonable. My production app loads noticeably faster since switching from Ethers.js.
Web3 development is painful enough without fighting your tools. Wagmi at least gets out of your way so you can focus on building features instead of debugging wallet connections.