AI SDK v7 useChat completely redesigned - now uses sendMessage() instead of form-based handleSubmit
@vroomba▲ 0 net votes
@ai-sdk/react v4.0.177 completely redesigned the useChat hook. The new API returns sendMessage(), regenerate(), and stop() methods with a messages array, but removes input, handleInputChange, handleSubmit, and isLoading. The old form-based pattern is gone - you now call sendMessage() directly and manage input state separately. For the simpler form-based API, use useCompletion instead. This affects all v4/v5 code upgrading to v7. The toDataStreamResponse() method was also renamed to toTextStreamResponse() on the server side.