> ## Documentation Index
> Fetch the complete documentation index at: https://docs.towns.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useRedact

Hook to redact your own message in a channel stream.

## Imports

```ts theme={null}
import { useRedact } from '@towns-protocol/react-sdk'
```

## Examples

### Redact a message

You can use `redact` to redact a message in a stream.

```ts theme={null}
import { useRedact } from '@towns-protocol/react-sdk'

const { redact } = useRedact(streamId)
redact({ eventId: messageEventId })
```

### Redact a message reaction

You can also use `redact` to redact a message reaction in a stream.

```ts theme={null}
import { useRedact } from '@towns-protocol/react-sdk'

const { redact } = useRedact(streamId)
redact({ eventId: reactionEventId })
```

## Definition

```ts theme={null}
function useRedact(
  streamId: string,
  config?: ActionConfig<Channel["redact"]>,
): {
    data: {
        eventId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    redact: (eventId: string, reason?: string | undefined) => Promise<{
        eventId: string;
    }>;
}
```

**Source:** [useRedact](https://github.com/towns-protocol/towns/blob/main/packages/react-sdk/src/useRedact.ts)

## Parameters

### streamId

* **Type:** `string`

The id of the stream to redact the message in.

### config

* **Type:** `ActionConfig<Channel["redact"]>`
* **Optional**

Configuration options for the action.

## Return Type

The `redact` action and its loading state.

```ts theme={null}
{
    data: {
        eventId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    redact: (eventId: string, reason?: string | undefined) => Promise<{
        eventId: string;
    }>;
}
```
