useIsChannelMember
Returns whether the user with the given id is already a member of the channel.
Best Practices
- Use this hook to drive "Add" / "Remove" affordances when managing channel members.
- Pass the id of the user you want to check; omit it and the hook returns
false. - Treat the result as derived state from the channel members and avoid local duplication.
- Useful when building add-member flows to filter out users who already belong to the channel.
Usage
import { useIsChannelMember } from "stream-chat-react-native";
const isMember = useIsChannelMember(channel, user.id);Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| channel | Channel |
Yes | Channel whose members are checked. |
| userId | string |
No | Id of the user to look for. false if omitted. |
Returns
| Type | Description |
|---|---|
boolean |
Whether the given user is a member of the channel. |