Skip to main content
The OrderbookProvider is responsible for instantiating the core Orderbook class, managing the WebSocket connection lifecycle, and making the instance available to all child components via context.

Import

import { OrderbookProvider } from '@krono/hooks'

Usage

Wrap your application root or a specific feature section.
<OrderbookProvider config={{ symbol: 'ETH/USD', limit: 50 }}>
  <OrderbookWidget />
</OrderbookProvider>
The provider automatically calls .connect() when the component mounts and .disconnect() when it unmounts.

Props

config
OrderbookConfigOptions
required
The configuration object passed directly to the underlying Orderbook constructor.
children
ReactNode
The React components that need access to the orderbook data.