I set up useChat with the default api route but when I send a message the messages array stays empty. No errors in console.
"use client"
import { useChat } from "ai/react"
export default function Chat() {
const { messages, input, handleSubmit, handleInputChange } = useChat()
return (
<div>
{messages.map(m => <p key={m.id}>{m.content}</p>)}
<form onSubmit={handleSubmit}>
<input value={input} onChange={handleInputChange} />
</form>
</div>
)
}
My api route just returns a basic text response. What format does the response need to be in? Do I need to use streamText?
ai@6.0.3, next.js 16