useChannelOnlineMemberCount
Returns the number of online members in a channel.
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
| Name | Type | Required | Description |
|---|---|---|---|
| channel | Channel |
No | Channel used to compute online count. |
Returns
| Type | Description |
|---|---|
number | undefined |
Number of online members. |