useMessages

Use the useMessages hook to get thread messages.
app.tsx
import { useMessages, } from '@superinterface/react' import { Message, } from '@superinterface/react/types' export const App = () => { const { messages, isFetching } = useMessages() if (isFetching) { return ( <div> Loading... </div> ) } return ( <> {messages.map((message: Message) => ( <div key={message.id} > {message.id} </div> ))} </> ) }

Arguments

No parameters available.
To modify variables passed to the mutation, use variables field of <SuperinterfaceProvider> or <Thread.Root>. To set other query options, use defaultOptions from <SuperinterfaceProvider> or <Thread.Root>.

Returns

Here's a summary of useMessages return properties:
PropType
messagesMessage[]
Good to know:
useMessages additionally returns all props from Tanstack Query useInfiniteQuery. So you can use props like isFetching, refetch and so on.