Hook to get the data of a DM. You can use this hook to get DM metadata and if the user has joined the DM.

Imports

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

Definition

function useDm(
  streamId: string,
  config?: ObservableConfig.FromData<DmModel>,
): {
    data: DmModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
} | {
    data: DmModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
} | {
    data: DmModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
}

Source: useDm

Parameters

streamId

  • Type: string

The id of the DM to get the data of.

config

  • Type: ObservableConfig.FromData<DmModel>
  • Optional

Configuration options for the observable.

Return Type

The DmModel of the DM.

{
    data: DmModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
} | {
    data: DmModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
} | {
    data: DmModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
}