useChannelMembershipState

Reads channel.state.membership reactively and re-renders on member.updated events.

Best Practices

  • Use this hook to drive membership-specific UI (pinned, archived, role, etc.).
  • Treat the return value as read-only state from the channel store.
  • Handle undefined when the channel is unavailable.
  • Keep derived booleans (e.g. isArchived) memoized in large list rows.
  • Avoid duplicating membership state in local component state.

Usage

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

const membership = useChannelMembershipState(channel);
const isArchived = Boolean(membership?.archived_at);

Parameters

NameTypeRequiredDescription
channelChannelNoChannel whose membership is read.

Returns

TypeDescription
ChannelMemberResponse | undefinedMembership data for the current user.