QubicTypeScript

QubicProvider

Root provider — initializes RPC clients and TanStack Query.

Required. Wrap your entire app in QubicProvider to make all data hooks work. It sets up TanStack Query and distributes the RPC clients through the component tree.

QubicProvider must be the outermost ancestor when used alongside VaultProvider or WalletProvider.

Usage

import { createLiveClient, createQueryClient } from "@qubic.org/rpc"
import { QubicProvider } from "@qubic.org/react"

const live = createLiveClient()
const archive = createQueryClient()

export function App() {
  return (
    <QubicProvider liveClient={live} archiveClient={archive}>
      {children}
    </QubicProvider>
  )
}

Props

PropTypeRequiredDescription
liveClientLiveClientYesFrom createLiveClient(). Used by all live data hooks.
archiveClientQueryClientNoFrom createQueryClient(). Required for useTransaction and useEventLogs.
queryClientTanStackQueryClientNoBring your own TanStack QueryClient if you already have one configured.

Notes

  • Every hook in @qubic.org/react requires QubicProvider as an ancestor.
  • archiveClient is optional but must be provided when using useTransaction or useEventLogs.
  • Pass queryClient only if your app already configures TanStack Query elsewhere; otherwise a default client is created internally.

On this page