stream-chat-react
Version:
React components to create chat conversations or livestream style chat
5 lines (4 loc) • 423 B
JavaScript
import { useMemo } from 'react';
import { findReverse } from '../../../utils/findReverse';
// fixme: we should be able to retrieve last own message quickly from the LLC. Should be done when refactoring the LLC Channel state to reactive.
export const useLastOwnMessage = ({ messages, ownUserId, }) => useMemo(() => messages && findReverse(messages, (msg) => (msg.user && msg.user.id) === ownUserId), [messages, ownUserId]);