import { useChannelOnlineMemberCount } from "stream-chat-react-native";
const onlineCount = useChannelOnlineMemberCount(channel) ?? 0;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
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| channel | Channel | No | Channel used to compute online count. |
Returns
| Type | Description |
|---|---|
number | undefined | Number of online members (excluding self). |