Function: useChatList()
useChatList(
chats?):ChatListItem[]
Defined in: hooks/useChatList.ts:41
Subscribes a component to every chat, most recently active first.
Parameters
chats?
Chat[]
Chats to list. Defaults to every defined chat.
Returns
A row per chat, recomputed whenever any chat changes
Example
function ChatList() {
const rows = useChatList();
return (
<ul>
{rows.map(({ chat, title, unread }) => (
<li key={chat.id}>{title}{unread > 0 && ` (${unread})`}</li>
))}
</ul>
);
}