This is beta documentation for Stream Chat React Native SDK v9. For the latest stable version, see the latest version (v8) .

useChannelOnlineMemberCount

Returns the number of online members in a channel excluding the current user.

Best Practices

  • Use this hook for lightweight presence summaries in list rows.
  • Keep online count formatting concise for compact channel previews.
  • Handle optional returns when channel is not yet available.
  • Avoid recomputing member online counts manually in render.
  • Pair this hook with member-state hooks only when additional details are needed.

Usage

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

const onlineCount = useChannelOnlineMemberCount(channel) ?? 0;

Parameters

NameTypeRequiredDescription
channelChannelNoChannel used to compute online count.

Returns

TypeDescription
number | undefinedNumber of online members (excluding self).