@towns-protocol/react-sdk
Version:
React Hooks for Towns Protocol SDK
32 lines • 1.03 kB
TypeScript
import { type Channel } from '@towns-protocol/sdk';
import { type ActionConfig } from './internals/useAction';
/**
* Hook to send a reaction to a message in a stream.
*
* Reaction can be any string value, including emojis.
*
* @example
* ```ts
* import { useSendReaction } from '@towns-protocol/react-sdk'
*
* const { sendReaction } = useSendReaction('stream-id')
* sendReaction(messageEventId, '🔥')
* ```
*
* @param streamId - The id of the stream to send the reaction to.
* @param config - Configuration options for the action.
* @returns The `sendReaction` action and its loading state.
*/
export declare const 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;
}>;
};
//# sourceMappingURL=useSendReaction.d.ts.map