Hook to redact your own message in a channel stream.

Imports

import { useRedact } from '@river-build/react-sdk'

Examples

Redact a message

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

import { useRedact } from '@river-build/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.

import { useRedact } from '@river-build/react-sdk'

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

Definition

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

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.

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