MCPcopy Create free account
hub / github.com/TanStack/query / ChatMessage

Function ChatMessage

examples/preact/chat/src/index.tsx:24–42  ·  view source on GitHub ↗
({ id, question }: { id: string; question: string })

Source from the content-addressed store, hash-verified

22}
23
24function ChatMessage({ id, question }: { id: string; question: string }) {
25 const {
26 error,
27 data = [],
28 isFetching,
29 } = useQuery(messagesQueries.detail(id, question))
30
31 if (error) return `An error has occurred: ${error.message}`
32
33 return (
34 <div>
35 <Message message={{ content: question, isQuestion: true }} />
36 <Message
37 inProgress={isFetching}
38 message={{ content: data.join(' '), isQuestion: false }}
39 />
40 </div>
41 )
42}
43
44function Example() {
45 const [questions, setQuestions] = useState<

Callers

nothing calls this directly

Calls 1

useQueryFunction · 0.90

Tested by

no test coverage detected