# useChannelPreviewData

Returns channel preview state (`lastMessage`, `muted`, and `unread`) for rendering list rows.

## Best Practices

- Use this hook in custom `ChannelPreview` components rendered by `ChannelList`.
- Treat `lastMessage` as optional and handle empty channels safely.
- Avoid additional unread computations in render; use the hook output directly.
- Respect muted channels and avoid showing unread badges when muted.
- Keep expensive formatting outside the list item render path.

## Usage

```tsx
import { useChannelPreviewData } from "stream-chat-react-native";

type Props = {
  channel: Channel;
  client: StreamChat;
};

const CustomPreview = ({ channel, client }: Props) => {
  const { lastMessage, muted, unread } = useChannelPreviewData(channel, client);

  return (
    <>
      <Text>{lastMessage?.text ?? "No messages yet"}</Text>
      {!muted && unread > 0 ? <Text>{unread}</Text> : null}
    </>
  );
};
```

## Parameters

| Name                | Type         | Required | Description                                                       |
| ------------------- | ------------ | -------- | ----------------------------------------------------------------- |
| channel             | `Channel`    | Yes      | Channel instance used to derive preview state and event bindings. |
| client              | `StreamChat` | Yes      | Active chat client used for read/unread event subscriptions.      |
| forceUpdateOverride | `number`     | No       | Optional force-update counter override from channel-list context. |

## Returns

| Name        | Type                                | Description                             |
| ----------- | ----------------------------------- | --------------------------------------- |
| lastMessage | `LocalMessage` \| `MessageResponse` | Latest message used by the preview row. |
| muted       | `MuteStatus`                        | Current mute status for the channel.    |
| unread      | `number`                            | Unread count for the current user.      |


---

This page was last updated at 2026-04-17T17:33:46.334Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react-native/hooks/channel-preview/use-channel-preview-data/](https://getstream.io/chat/docs/sdk/react-native/hooks/channel-preview/use-channel-preview-data/).