---
source_url: https://www.pubnub.com/docs/chat/components/react-native/custom-hooks/use-presence
title: usePresence for PubNub Chat Components for React Native
updated_at: 2026-06-11T11:33:51.117Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# usePresence for PubNub Chat Components for React Native

:::warning Migrate to Chat SDK
PubNub will stop supporting Chat Components on January 1, 2025 but you are [welcome to contribute](https://github.com/pubnub/react-chat-components). Learn how to migrate to the Chat SDK [here](https://www.pubnub.com/docs/general/resources/migration-guides/react-components-chat-sdk).
:::

The hook returns the list of unique user IDs currently subscribed to the channel.

This hook also sets up a listener that reacts to new presence events (joins and leaves/timeouts). However, this behavior requires a living subscription to the channels passed to the hook - this should be handled by the components.

Information returned by this hook can be used to show a presence indicator, or a number of people currently subscribed to the channel.

```tsx
const [channels, refetchPresence, totalPresence, error, isLoading] = usePresence({
  channels: ["test-channel"],
});

return <p>Occupancy of the channel: {channels["test-channel"].occupancy}</p>;
```

## Input

:::note User ID / UUID
User ID is also referred to as **UUID/uuid** in some APIs and server responses but **holds the value** of the **userId** parameter you [set during initialization](https://www.pubnub.com/docs/general/setup/users-and-devices#set-the-user-id).
:::

| Parameter | Defaults | Description |
| --- | --- | --- |
| channels | Array | Optional |  | n/a | Channel name to return occupancy results. If channel is not provided, `hereNow()` will return data for all channels. |
| channelGroups | Array | Optional |  | n/a | Channel group for which `hereNow()` information should be received. |
| includeUUIDs | Boolean | Optional |  | `true` | Option to disable returning User IDs. |
| includeState | Boolean | Optional |  | `false` | Option to enable returning subscriber state information. |

## Output

| Parameter | Description |
| --- | --- |
| `array[0]`Type: ChannelPresence[] | List of returned channel presence data. |
| `array[1]`Type: Function | Refetching presence from scratch. This is rarely needed since the hook sets up presence listeners to get updates. |
| `array[2]`Type: Number | Total number of present users across all passed channels. |
| `array[3]`Type: Error | If there's an error fetching presence, it will be available here. |
| `array[4]`Type: Boolean | Indicator that the channel presence data is still being loaded. |

### ChannelPresence interface

```tsx
  [channel: string]: {
    name: string;
    occupancy: number;
    occupants?: {
      uuid: string;
      state?: unknown;
    }[];
  };
```