useChannelName

Reads channel.data?.name reactively and re-renders when the channel is updated.

Best Practices

  • Use this hook to render the channel name in headers, previews, and details screens.
  • Treat the value as read-only state derived from the channel store.
  • Handle undefined when the channel has no name or is unavailable.
  • Prefer this hook over reading channel.data?.name directly so the UI stays in sync with channel.updated events.
  • Combine with a display-name fallback (e.g. member names) for direct messages without an explicit name.

Usage

import { useChannelName } from "stream-chat-react-native";

const name = useChannelName(channel);

Parameters

NameTypeRequiredDescription
channelChannelNoChannel whose name is read.

Returns

TypeDescription
string | undefinedThe channel's name, or undefined if not set.