clawchain/wagmi/site/react/installation.md

1.8 KiB

Installation

Install Wagmi via your package manager, a <script> tag, or build from source.

Package Manager

Install the required packages.

::: code-group

pnpm add wagmi viem@{{viemVersion}} @tanstack/react-query
npm install wagmi viem@{{viemVersion}} @tanstack/react-query
yarn add wagmi viem@{{viemVersion}} @tanstack/react-query
bun add wagmi viem@{{viemVersion}} @tanstack/react-query

:::

  • Viem is a TypeScript interface for Ethereum that performs blockchain operations.
  • TanStack Query is an async state manager that handles requests, caching, and more.
  • TypeScript is optional, but highly recommended. Learn more about TypeScript support.

CDN

If you're not using a package manager, you can also use Wagmi via an ESM-compatible CDN such as esm.sh. Simply add a <script type="module"> tag to the bottom of your HTML file with the following content.

<script type="module">
  import React from 'https://esm.sh/react@18.2.0'
  import { QueryClient } from 'https://esm.sh/@tanstack/react-query'
  import { createClient } from 'https://esm.sh/viem@{{viemVersion}}'
  import { createConfig } from 'https://esm.sh/wagmi'
</script>

Check out the React docs for info on how to use React without JSX.