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

Imports

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

Definition

function useChannel(
  spaceId: string,
  channelId: string,
  config?: ObservableConfig.FromObservable<Channel>,
): {
    data: ChannelModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
} | {
    data: ChannelModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
} | {
    data: ChannelModel;
    error: Error | undefined;
    status: "error" | "loading" | "loaded";
    isLoading: boolean;
    isError: boolean;
    isLoaded: boolean;
}

Source: useChannel

Parameters

spaceId

  • Type: string

The id of the space the channel belongs to.

channelId

  • Type: string

The id of the channel to get data about.

config

  • Type: ObservableConfig.FromObservable<Channel>
  • Optional

Configuration options for the observable.

Return Type

The ChannelModel data.

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