# React SDK

## Installation <a href="#installation" id="installation"></a>

To install the React SDK, use your preferred package manager from the command line. For example, if you use bun, execute the following command:

{% code overflow="wrap" %}

```bash
bun add @inverter-network/react wagmi@^2.14.11 viem@^2.24.2 @tanstack/react-query@^5.59.0
```

{% endcode %}

***

## Initializing the React SDK <a href="#initializing-the-sdk" id="initializing-the-sdk"></a>

Since our React SDK uses `@tanstack/react-query`, `wagmi` and `viem` we need these instances to be present at the parent level.

`@inverter-network/react` SDK has the export paths `@inverter-network/react` and `@inverter-network/react/client` Client components and hooks are exported from `*/client` this is done to ensure `Next.js` users have a separate import path for server components .

{% code overflow="wrap" %}

```typescript
'use client'

import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { getERPCTransport } from '@inverter-network/sdk'
import { WagmiProvider, createConfig, http } from 'wagmi'
import { sepolia } from 'viem/chains'

const chains = [sepolia]

const queryClient = new QueryClient()

const wagmiConfig = createConfig({
    chains,
    multiInjectedProviderDiscovery: false,
    transports: {
        [sepolia.id]: getERPCTransport(sepolia.id),
    },
    ssr: true, // If the user is using a SSR supporting framework
    cacheTime: 5000, // 5 seconds
  })

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <QueryClientProvider client={queryClient}>
      <WagmiProvider config={wagmiConfig} reconnectOnMount>
        {children}
      </WagmiProvider>
    </QueryClientProvider>
  )
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inverter.network/sdk/react-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
