stream-chat-react
Version:
React components to create chat conversations or livestream style chat
15 lines (14 loc) • 503 B
JavaScript
export const useUserHandler = (message, eventHandlers) => ({
onUserClick: (event) => {
if (typeof eventHandlers?.onUserClickHandler !== 'function' || !message?.user) {
return;
}
eventHandlers.onUserClickHandler(event, message.user);
},
onUserHover: (event) => {
if (typeof eventHandlers?.onUserHoverHandler !== 'function' || !message?.user) {
return;
}
eventHandlers.onUserHoverHandler(event, message.user);
},
});