Hook to send a reaction to a message in a stream.
Reaction can be any string value, including emojis.
Imports
import { useSendReaction } from '@towns-protocol/react-sdk'
Examples
import { useSendReaction } from '@towns-protocol/react-sdk'
const { sendReaction } = useSendReaction('stream-id')
sendReaction(messageEventId, '🔥')
Definition
function useSendReaction(
streamId: string,
config?: ActionConfig<Channel["sendReaction"]>,
): {
data: {
eventId: string;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
sendReaction: (refEventId: string, reaction: string) => Promise<{
eventId: string;
}>;
}
Source: useSendReaction
Parameters
streamId
The id of the stream to send the reaction to.
config
- Type:
ActionConfig<Channel["sendReaction"]>
- Optional
Configuration options for the action.
Return Type
The sendReaction
action and its loading state.
{
data: {
eventId: string;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
sendReaction: (refEventId: string, reaction: string) => Promise<{
eventId: string;
}>;
}