Skip to main content
Destroying the orderbook is an irreversible action for that specific instance. Use primarily when unmounting top-level providers.
This hook requires the OrderbookProvider to be present in your component tree to provide the underlying Orderbook instance.

Import

import { useOrderbookLifecycle } from '@krono/hooks'

Usage

import { useOrderbookLifecycle } from '@krono/hooks'

function AdminControls() {
  const { destroy } = useOrderbookLifecycle();

  return (
    <button onClick={destroy}>
      Destroy orderbook
    </button>
  );
}

Return Type

Actions

destroy
() => void
Disconnects the Websocket, clears the price maps, empties the history buffer, and removes all internal event listeners.