# MessageComposerAPIContext

`MessageComposerAPIContext` is provided by [`Channel`](/chat/docs/sdk/react-native/v8/core-components/channel/). If you are not familiar with the React Context API, see the [React docs](https://reactjs.org/docs/context.html).

## Best Practices

- Use this context only for editing/quoting state changes.
- Read `editedMessage` and `quotedMessage` from `useMessageComposer` for state.
- Clear edit/quote state promptly to avoid stale UI.
- Keep handlers stable to avoid re-renders in the input.
- Avoid using this context deep in the message list.

## Basic Usage

Consume `MessageComposerAPIContext` in any child of `Channel`:

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

const { setEditingState, clearEditingState } = useMessageComposerAPIContext();
```

<admonition type="note">

To read `editing` and `quotedMessage` state, use the `useMessageComposer` hook.

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

const { editedMessage, quotedMessage } = useMessageComposer();
```

</admonition>

## Value

### `setEditingState`

Function to set the editing state of the message composer.

| Type                                           | Description                                     |
| ---------------------------------------------- | ----------------------------------------------- |
| `(message: LocalMessage \| undefined) => void` | Sets the editing state of the message composer. |

### `clearEditingState`

Function to clear the editing state of the message composer.

| Type         | Description                                       |
| ------------ | ------------------------------------------------- |
| `() => void` | Clears the editing state of the message composer. |

### `setQuotedMessage`

Function to set the quoted message in the message composer.

| Type                                           | Description                                      |
| ---------------------------------------------- | ------------------------------------------------ |
| `(message: LocalMessage \| undefined) => void` | Sets the quoted message in the message composer. |


---

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

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react-native/v8/contexts/message-composer-api-context/](https://getstream.io/chat/docs/sdk/react-native/v8/contexts/message-composer-api-context/).