> For the complete documentation index, see [llms.txt](https://docs.minchat.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.minchat.io/react-native-sdk/usechats-hook.md).

# useChats hook

the `useChats` hook is used to interface with chats.

```javascript
import { useChats } from '@minchat/reactnative';
```

### Get list of conversations

You can get a list of the conversations of the current user. conversations retrieved are paginated to 25 messages at a time. New conversations started by other users or messages sent to conversations that are on a different page are automatically added to the `chats` array.

```javascript
const { chats, loading, error, paginate, paginateLoading } = useChats()
```

<table><thead><tr><th width="223">Field</th><th width="130.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>chats</code></td><td><a href="/pages/f4MIOym3eJzAXzLLXniX"><code>Chat[]</code></a></td><td>the list of chats returned. this is automatically updated whenever a new chat is started by the current user or someone else.</td></tr><tr><td><code>loading</code></td><td><code>boolean</code></td><td>Shows the state of querying the chats, used to update your UI to show loading state</td></tr><tr><td><code>error</code></td><td><code>object</code></td><td>an error object that is defined if an error occured while trying to query the chats.</td></tr><tr><td><code>paginate</code></td><td><code>function</code></td><td>function called to get the next 25 chats, the chats are automatically added to the begining of the chats array.</td></tr><tr><td><code>paginateLoading</code></td><td><code>boolean</code></td><td>Shows the state of a paginated query for chats, used to update your UI to show pagination state. is true when the paginate function is called and is false when chats are returned</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.minchat.io/react-native-sdk/usechats-hook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
