React SDK reference
Provider and hooks from @lynkoria/react.
import { LynkoriaProvider } from '@lynkoria/react';
<LynkoriaProvider client={client}>
<App />
</LynkoriaProvider>;The provider connects the client on mount and disconnects it on unmount. Create the client once per signed-in user, outside render or in useMemo keyed by the user.
Hooks
| Hook | Returns |
|---|---|
useLynkoria() | The LynkoriaClient from the provider. |
useConnectionState() | idle, connecting, connected, reconnecting or disconnected; re-renders on change. |
useConversation(id) | { messages, loading, error, hasMore, loadOlder(), send(text, { attachmentIds?, parentMessageId? }), markRead() }. History plus live events, ordered and deduplicated. |
usePresence(userId) | Latest Presence or null. |
useTyping(conversationId) | User IDs currently typing (entries expire after 6 seconds). |
useCall() | { session, state, error, join(options), leave() }. Leaves on unmount; cancels superseded joins. |
useCallParticipants(s) | Live CallParticipant[] for a session (joins, leaves, mute, camera, screen, speaking, connection quality); [] without a session. |
Notes
useConversationkeys its state by conversation ID, so switching conversations never shows another conversation’s messages.- Realtime edits and deletes that arrive while history is loading are kept; the exported
applyEventandmergeHistoryhelpers implement this for custom state stores. - Render
session.roomwith@livekit/components-reactinsideRoomContext.Provider.
API reference
Every export with its signature, generated from the package build: react reference.