Hook to get the threads from a stream.

Imports

import { useThreads } from '@river-build/react-sdk'

Definition

function useThreads(
  streamId: string,
  config?: ObservableConfig.FromObservable<Threads>,
): {
    data: {
        [x: string]: TimelineEvent[];
    };
    error: undefined;
    status: "loading" | "loaded";
    isLoading: boolean;
    isError: false;
    isLoaded: boolean;
}

Source: useThreads

Parameters

streamId

  • Type: string

The id of the stream to get the threads from.

config

  • Type: ObservableConfig.FromObservable<Threads>
  • Optional

Configuration options for the observable.

Return Type

The threads of the stream as a map from the message eventId to a thread.

{
    data: {
        [x: string]: TimelineEvent[];
    };
    error: undefined;
    status: "loading" | "loaded";
    isLoading: boolean;
    isError: false;
    isLoaded: boolean;
}