UseChannel
useChannel
Provides access to the ChannelContext which contains information about the active channel.
Example
const { activeChannel } = useChannel();
Signature
function useChannel(): void
ChannelContext
Provides information about the active channel, and the means to set a new active channel.
Signature
interface ChannelContext {
isLoading: boolean;
channels: Channel[];
activeChannel: ActiveChannel | undefined;
setActiveChannel: (channelId: string) => void;
refreshChannels: () => void;
}
isLoading
property
boolean
Whether the channels are loading.
channels
property
Channel[]
An array of all available channels.
activeChannel
property
ActiveChannel | undefined
The active channel.
setActiveChannel
property
(channelId: string) => void
The function to set the active channel.
refreshChannels
property
() => void
The function to refresh the channels.