use-channel.md 1.9 KB


title: "UseChannel" isDefaultIndex: false

generated: true

import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription';

useChannel

Provides access to the ChannelContext which contains information about the active channel.

Example

const { activeChannel } = useChannel();
function useChannel(): void

ChannelContext

Provides information about the active channel, and the means to set a new active channel.

interface ChannelContext {
    isLoading: boolean;
    channels: Channel[];
    activeChannel: ActiveChannel | undefined;
    setActiveChannel: (channelId: string) => void;
    refreshChannels: () => void;
}
### isLoading Whether the channels are loading. ### channels Channel[]`} /> An array of all available channels. ### activeChannel The active channel. ### setActiveChannel The function to set the active channel. ### refreshChannels The function to refresh the channels.