import { useChannelImage } from "stream-chat-react-native";
const image = useChannelImage(channel);useChannelImage
Reads channel.data?.image reactively and re-renders when the channel is updated.
Best Practices
- Use this hook to drive the channel avatar/image in headers, previews, and details screens.
- Treat the value as read-only state derived from the channel store.
- Handle
undefinedand provide a fallback avatar (e.g. member images or initials). - Prefer this hook over reading
channel.data?.imagedirectly so the UI stays in sync withchannel.updatedevents.
Usage
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| channel | Channel | No | Channel whose image is read. |
Returns
| Type | Description |
|---|---|
string | undefined | The channel's image URL, or undefined if not set. |