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

NameTypeRequiredDescription
channelChannelYesChannel whose members are checked.
userIdstringNoId of the user to look for. false if omitted.

Returns

TypeDescription
booleanWhether the given user is a member of the channel.