# useMessages Send room chat and read the provider's local history. ## Import ```tsx import { useMessages } from '@relayrtc/react' ``` ## Requirements Call this hook inside [RelayProvider](/reference/sdk/client/react/RelayProvider), in a React function component or custom hook. A joined room is needed for live data and actions. ## Returns | Field | Type | Meaning | | --- | --- | --- | | messages | readonly RoomTextMessage[] | Messages collected by this provider. | | send | `(text: string) => Promise` | Send a text message. | | clear | `() => void` | Clear only this client's history. | ## Example ```tsx const { messages, send } = useMessages() return (
{messages.map((message) =>

{message.text}

)}
) ``` ## Options and behavior Sending requires messages:send. Text must be nonblank and no longer than 4,000 characters. A message contains messageId, roomId, participantId and text. History is local, limited by messageHistoryLimit, and is not persisted across reloads.